Systems and methods for cascaded model predictive control

ABSTRACT

A cascaded model predictive control system includes an inner controller and an outer controller. The outer controller determines an amount of power to defer from a predicted power usage to optimize a total cost of power usage. A power setpoint is calculated based on a difference between the predicted power usage and the amount of power to defer. The inner controller determines an operating setpoint for building equipment in order to achieve the power setpoint.

CROSS-REFERENCE TO RELATED PATENT APPLICATION

This application is a continuation of U.S. patent application Ser. No. 13/802,154 filed Mar. 13, 2013, the entire disclosure of which is incorporated by reference herein.

BACKGROUND

The present disclosure relates to systems and methods for minimizing energy cost in response to time-varying pricing scenarios. The systems and methods described herein may be used for demand response in building or HVAC systems such as those sold by Johnson Controls, Inc.

The rates that energy providers charge for energy often vary throughout the day. For example, energy providers may use a rate structure that assigns different energy rates to on-peak, partial-peak, and off-peak time periods.

Additionally, energy providers often charge a fee known as a demand charge. A demand charge is a fee corresponding to the peak power (i.e. the rate of energy use) at any given time during a billing period. In a variable pricing scenario that has an on-peak, partial-peak, and off-peak time period, a customer is typically charged a separate demand charge for maximum power use during each pricing period.

Energy providers can also offer customers the option to participate in a critical-peak pricing (CPP) program. In a CPP program, certain days throughout a billing period are designated as CPP days. On a CPP day, the on-peak time period is often divided in two or more sub-periods. CPP periods may also have separate demand charges for each sub-period. As an incentive to participate in the CPP program, customers are charged a lower energy rate on non-CPP days during the billing period.

Energy providers also often engage in real-time pricing (RTP). RTP energy rates change frequently and can vary quite drastically throughout the day. RTP periods may also have a separate demand charge for each RTP period. It is challenging and difficult for energy customers would like to minimize the cost that they pay for energy where pricing scenarios can be mixed.

Control actions can be taken to respond to variable pricing scenarios. One response is to turn off equipment. However, when the energy is used to drive a heating or cooling system for a building, the cost minimization problem is often subject to constraints. For example, it is desirable to maintain the building temperature within an acceptable range. Methods that are more proactive include storing energy in batteries or using ice storage to meet the future cooling loads. A problem with many of these techniques is the requirement for large, expensive, and non-standard equipment.

A method that does not require additional equipment is storing energy in the thermal mass of the building. This form of thermal energy storage risks leading to either uncomfortable building zone temperatures or demand charges that are not significantly reduced. One technique is to pre-cool the building to a minimum allowable temperature and to determine the temperature setpoint trajectory that will minimize power use while maintaining the temperature below a maximum allowable value. With this technique, the demand can be curtailed and the zone temperature can remain within temperature comfort bounds.

Traditional methods are less than optimal and are unable to handle RTP pricing scenarios with rapidly changing energy prices or CPP pricing scenarios having several regions of interest for both energy and demand charges. Furthermore, traditional methods may have difficulty accounting for varying disturbances to the system or changes to the system which are likely to necessitate re-developing or retraining the underlying model.

Energy cost minimization systems and methods are needed to address a plurality of variable pricing schemes including the rapidly changing energy cost structures of CPP and RTP. Additionally, a method is needed which handles the possibility of multiple demand charge regions and which handles varying disturbances and changes to the system without the need to re-train the model.

SUMMARY

One implementation of the present disclosure is a heating, ventilation, or air conditioning (HVAC) system for a building. The HVAC system includes a building system, a load predictor, an outer controller, an inner controller, and HVAC equipment. The building system includes one or more measurement devices configured to measure at least one of a measured temperature of the building or a measured power usage of the building and generate a feedback signal including at least one of the measured temperature of the building or the measured power usage of the building. The load predictor is configured to predict a future power usage of the building. The outer controller is configured to receive the feedback signal from the building system, receive time-varying pricing information, perform an optimization process to determine an amount of power to defer from the predicted power usage based on the feedback signal and the pricing information, and output a power control signal indicating the amount of power to defer. The amount of power to defer optimizes a total cost of the power usage of the building. The inner controller is configured to receive a power setpoint representing a difference between the predicted power usage and the amount of power to defer, determine an operating setpoint for the building system predicted to achieve the power setpoint, and output a second control signal indicating the operating setpoint. The HVAC equipment include one or more physical devices. The building system is configured to operate the HVAC equipment to achieve the operating setpoint. At least one of the outer controller or the inner controller is an electronic device including a communications interface and a processing circuit.

In some embodiments, the feedback signal includes both information representative of the measured temperature and information representative of the measured power usage of the building.

In some embodiments, the outer controller is configured to receive a dynamic model describing heat transfer characteristics of the building and temperature constraints defining an acceptable range for the measured temperature. In some embodiments, the outer controller is configured to use the dynamic model and the feedback signal to estimate a temperature state for the building as a function of power usage. In some embodiments, the outer controller is configured to use an optimization procedure to determine a power usage for the building which minimizes the total cost of the power usage while maintaining the estimated temperature state within the acceptable range.

In some embodiments, the outer controller and the inner controller have different sampling and control intervals. The sampling and control interval of the outer controller may be longer than the sampling and control interval of the inner controller. In some embodiments, the outer controller and the inner controller are physically decoupled in location.

In some embodiments, the time-varying pricing information includes demand charge information defining a cost per unit of power corresponding to a maximum power usage within a pricing period. In some embodiments, the time-varying pricing information includes demand charge information for two or more of a plurality of pricing periods.

In some embodiments, the second control signal includes at least one of the operating setpoint or a derivative of the operating setpoint.

In some embodiments, the power control signal includes at least one of the power setpoint received by the inner controller or the amount of power to defer from a predicted power usage. In some embodiments, the amount of power to defer is subtracted from the predicted power usage to calculate the power setpoint received by the inner controller.

In some embodiments, the load predictor configured to receive the operating setpoint and at least one of current weather information, past weather information, or past building power usage. In some embodiments, the load predictor is configured to output the predicted power usage. The power control signal may be an amount of power to defer from the predicted power usage.

Another implementation of the present disclosure is a method for heating, ventilating, or air conditioning a building. The method includes measuring at least one of a measured temperature of the building or a measured power usage of the building, generating a feedback signal including at least one of the measured temperature of the building or the measured power usage of the building, and predicting a future power usage of the building based on historical weather and power usage data. The method includes performing an optimization process to determine an amount of power to defer from the predicted power usage based on the feedback signal and time-varying pricing information and generating a power control signal indicating the amount of power to defer. The amount of power to defer optimizes a total cost of the power usage of the building. The method includes calculating a power setpoint representing a difference between the predicted power usage and the amount of power to defer, determining an operating setpoint predicted to achieve the power setpoint, generating a second control signal indicating the operating setpoint, and operating HVAC equipment to achieve the operating setpoint, the HVAC equipment comprising one or more physical devices.

In some embodiments, the feedback signal includes both information representative of the measured temperature and information representative of the measured power usage of the building.

In some embodiments, the method includes receiving a dynamic model describing heat transfer characteristics of the building and temperature constraints defining an acceptable range for the measured temperature, using the dynamic model and the feedback signal to estimate a temperature state for the building as a function of power usage, and using an optimization procedure to determine a power usage for the building which minimizes the total cost of the power usage while maintaining the estimated temperature state within the acceptable range.

In some embodiments, the power control signal is generated by an outer controller having a first sampling and control interval and the second control signal is generated by an inner controller having a second sampling and control interval shorter than the first sampling and control interval. In some embodiments, the power control signal is generated by an outer controller and the second control signal is generated by an inner controller physically decoupled in location from the outer controller.

In some embodiments, the time-varying pricing information includes demand charge information defining a cost per unit of power corresponding to a maximum power usage within a pricing period. In some embodiments, the time-varying pricing information includes demand charge information for two or more of a plurality of pricing periods.

In some embodiments, the second control signal includes at least one of the operating setpoint or a derivative of the operating setpoint.

In some embodiments, the method includes subtracting the amount of power to defer from the predicted power usage to calculate the power setpoint. In some embodiments, the power control signal includes at least one of the power setpoint or the amount of power to defer from a predicted power usage.

In some embodiments, the method includes receiving the operating setpoint and at least one of current weather information, past weather information, and past building power usage. In some embodiments, the method includes outputting the predicted power usage. The power control signal may be an amount of power to defer from the predicted power usage.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 is a chart illustrating an exemplary “time of use” energy rate structure in which the cost of energy depends on the time of use.

FIG. 2 is a chart illustrating an exemplary critical-peak pricing structure with multiple pricing levels within the critical peak pricing period.

FIG. 3 is a chart illustrating an exemplary real-time pricing structure with many different price levels and a rapidly changing energy cost.

FIG. 4 is a flow chart of a process for minimizing the cost of energy in response to a variable energy pricing structure, according to an exemplary embodiment.

FIG. 5A is a flowchart of a process for developing a framework energy model for a building system and obtaining system parameters for the framework energy model, according to an exemplary embodiment, according to an exemplary embodiment.

FIG. 5B is a block diagram of a model predictive controller including memory on which instructions for the various processes described herein are contained, a processor for carrying out the processes, and a communications interface for sending and receiving data, according to an exemplary embodiment.

FIG. 6 is a block diagram of a cascaded model predictive control system featuring an inner MPC controller and an outer MPC controller, according to an exemplary embodiment.

FIG. 7 is a detailed block diagram showing the inputs and outputs of the inner MPC controller, according to an exemplary embodiment.

FIG. 8 is a detailed block diagram showing the inputs and outputs of the outer MPC controller, according to an exemplary embodiment.

FIG. 9 is an energy balance diagram for formulating an energy model of the building system used by the inner MPC controller, according to an exemplary embodiment.

FIG. 10 is an energy balance diagram for formulating an energy model of the building system used by the outer MPC controller, according to an exemplary embodiment.

FIG. 11 is a flowchart of a process for identifying model parameters in an offline or batch process system identification process using a set of training data, according to an exemplary embodiment.

FIG. 12 is a flowchart of a process for recursively identifying updated model parameters and checking the updated model parameters for stability and robustness, according to an exemplary embodiment.

FIG. 13 is a flowchart of a process for defining an energy cost function, linearizing the cost function by adding demand charge constraints to the optimization procedure, and masking invalid demand charge constraints, according to an exemplary embodiment.

FIG. 14 is a graph showing a plurality of pricing periods, a time-step having a valid demand charge constraint within one pricing period and an invalid demand charge constraint within another pricing period, according to an exemplary embodiment.

FIG. 15 is a flowchart of an optimization process for minimizing the result of an energy cost function while satisfying temperature constraints, equality constraints, and demand charge constraints.

FIG. 16 is a flowchart of a process for recursively updating an energy model, updating equality constraints and demand charge constraints, and recursively implementing the masking procedure and optimization procedure.

DETAILED DESCRIPTION

Referring to FIG. 1, a chart 100 illustrating “time of use” (TOU) energy pricing is shown, according to an exemplary embodiment. In a TOU pricing scheme, an energy provider may charge a baseline price 102 for energy used during an off-peak period and a relatively higher price 104 for energy used during an on-peak period. For example, during an off-peak period, energy may cost $0.10 per kWh whereas during an on-peak period, energy may cost $0.20 per kWh. Energy cost may be expressed as a cost per unit of energy using any measure of cost and any measure of energy (e.g., $/kWh, $/J, etc.).

Referring now to FIG. 2, a chart 200 illustrating a critical-peak pricing (CPP) structure is shown, according to an exemplary embodiment. In a CPP pricing scenario, a high price 204 may be charged for energy used during the CPP period. For example, an energy provider may charge two to ten times the on-peak energy rate 202 during a CPP period. Certain days in a billing cycle may designated as CPP days and the CPP period may be divided in two or more sub-periods. CPP periods may also have separate demand charges for each sub-period.

Referring now to FIG. 3, a chart 300 illustrating a real-time pricing structure is shown, according to an exemplary embodiment. In an RTP structure, energy cost may change as often as once per fifteen minutes and may vary significantly throughout a day or throughout a billing cycle. The systems and methods described herein may be used to minimize energy cost in a building system subject to time-varying energy prices.

Referring now to FIG. 4, a flowchart illustrating a process 400 of minimizing energy cost in a building system is shown, according to an exemplary embodiment. Process 400 is shown to include receiving an energy model for the building system (step 402), receiving system state information (e.g., measurements or estimates of current conditions in the building system such as temperature, power use, etc.) (step 404), receiving an energy cost function for the building system (step 406), and using an optimization procedure to minimize the total energy cost for the building system (step 408).

As stated above with reference to FIG. 4, process 400 includes receiving an energy model for the building system (step 402). The energy model for the building system (i.e., the system model) may be a mathematical representation of the building system and may be used to predict how the system will respond to various combinations of manipulated inputs and uncontrolled disturbances. For example, the energy model may be used to predict the temperature or power usage of the building in response to a power or temperature setpoint (or other controlled variable).

The energy model may describe the energy transfer characteristics of the building. Energy transfer characteristics may include physical traits of the building which are relevant to one or more forms of energy transfer (e.g., thermal conductivity, electrical resistance, etc.). Additionally, the energy model may describe the energy storage characteristics of the building (e.g., thermal capacitance, electrical capacitance, etc.) as well as the objects contained within the building. The energy transfer and energy storage characteristics of the building system may be referred to as system parameters.

In some embodiments, step 402 may include receiving a pre-defined system model including all the information needed to accurately predict the building's response (e.g., all the system parameters). In other embodiments, step 402 may include developing the model (e.g., by empirically determining the system parameters).

Step 402 may include formulating a system of equations to express future system states and system outputs (e.g., future building temperature, future power usage, etc.) as a function of current system states (e.g., current building temperature, current power usage, etc.) and controllable system inputs (e.g., a power setpoint, a temperature setpoint, etc.). Step 402 may further include accounting for disturbances to the system (e.g., factors that may affect future system states and system outputs other than controllable inputs), developing a framework model using physical principles to describe the energy characteristics of the building system in terms of undefined system parameters, and obtaining system parameters for the framework model. Step 402 may be accomplished using process 500, described in greater detail in reference to FIG. 5.

Still referring to FIG. 4, method 400 may include receiving system state information (step 404). Receiving system state information may include conducting and/or receiving measurements or estimates of current building conditions (i.e., current states of the building system) such as building temperature, building power use, etc.). System state information may include information relating to directly measurable system states or may include estimated or calculated quantities. Materials within the building may have a thermal capacitance and therefore may be used to store a thermal load (e.g., a heating or cooling load). System state information may include an estimation of an amount of heat currently stored by the capacitive objects within the building.

Still referring to FIG. 4, method 400 may include receiving an energy cost function for the building system (step 406). The energy cost function may be used to calculate a total energy cost within a finite time horizon. Current system state information (e.g., measurements of current power usage) as well as predicted future system states (e.g., estimated future power usage) may be used in combination with time-varying price information for one or more pricing periods (e.g., off-peak, on-peak, critical peak, etc.) to calculate a total cost of energy based on a predicted energy usage.

In some embodiments, step 406 may include receiving a pre-defined cost function including all of the information necessary to calculate a total energy cost. A pre-defined cost function may be received from memory (e.g., computer memory or other information storage device), specified by a user, or otherwise received from any other source or process.

In other embodiments, step 406 may include defining one or more terms in the cost function using a cost function definition process. Step 406 may include receiving time-varying pricing information for a plurality of pricing periods. Time-varying pricing information may include energy cost information (e.g., price per unit of energy) as well as demand charge information (e.g., price per unit of power) corresponding to a maximum power use within a pricing period. Step 406 may further include receiving a time horizon within which energy cost may be calculated and expressing the total cost of energy within the time horizon as a function of estimated power use. Predicted future power use may be used in combination with energy pricing information for such periods to estimate the cost future energy use. Step 406 may further include expressing the cost function as a liner equation by adding demand charge constraints to the optimization procedure and using a masking procedure to invalidate demand charge constraints for inactive pricing periods. Step 406 may be accomplished using a cost function definition process such as process 1300, described in greater detail in reference to FIG. 13.

Still referring to FIG. 4, method 400 may include using an optimization procedure to minimize the total energy cost for the building system (step 408). Step 408 may include receiving temperature constraints, using the energy model and the system state information to formulate equality constraints, and determining an optimal power usage or setpoint to minimize the total cost of energy within a finite time horizon (e.g., minimize the energy cost determined by the cost function) while maintaining building temperature within acceptable bounds. Equality constraints may be used to guarantee that the optimization procedure considers the physical realities of the building system (e.g., energy transfer principles, energy characteristics of the building, etc.) during cost minimization. In other words, equality constraints may be used to predict the building's response (e.g., how the system states and outputs will change) to a projected power usage or temperature setpoint, thereby allowing the energy cost function to be minimized without violating the temperature constraints. Step 408 may be accomplished using an optimization process such as process 1500 described in greater detail in reference to FIG. 15.

Referring now to FIG. 5A, a flowchart illustrating a process 500 to develop an energy model for the building system is shown, according to an exemplary embodiment. Process 500 may be used to accomplish step 402 of method 400. Process 500 may include formulating a system of equations to express future system states and system outputs (e.g., future building temperature, future power use, etc.) as a function of current system states (e.g., current building temperature, current power use, etc.) and controllable inputs to the system (e.g., a power setpoint, a temperature setpoint, or other manipulated variables) (step 502). Process 500 may further include accounting for disturbances to the system (e.g., factors other than controllable inputs) such as outside temperature or weather conditions that may affect future system states and system outputs (step 504). Additionally, process 500 may include developing a framework model using physical principles to describe the energy characteristics of the building system in terms of undefined system parameters (step 506), and obtaining system parameters for the framework model (step 508).

Still referring to FIG. 5A, process 500 may include formulating a system of equations to express future system states and system outputs as a function of current system states and controllable system inputs (step 502). In an exemplary embodiment, a state space representation is used to express future system states and system outputs in discrete time as a function current system states and inputs to the system 502. However, step 502 may include formulating any type of equation (e.g., linear, quadratic, algebraic, trigonometric, differential, etc.) to express future system states. In the example embodiment, a state space modeling representation may be expressed in discrete time as: x(k+1)=Ax(k)+Bu(k) y(k)=Cx(k)+Du(k) where x represents the states of the system, u represents the manipulated variables which function as inputs to the system, and y represents the outputs of the system. Time may be expressed in discrete intervals (e.g., time-steps) by moving from a time-step k to the next time-step k+1.

In the exemplary embodiment, the state space system may be characterized by matrices A, B, C, and D. These four matrices may contain the system parameters (e.g., energy characteristics of the building system) which allow predictions to be made regarding future system states. In some embodiments, the system parameters may be specified in advance, imported from a previously identified system, received from a separate process, specified by a user, or otherwise received or retrieved. In other embodiments, system matrices A, B, C, and D may be identified using a system identification process, described in greater detail in reference to FIG. 11.

In further embodiments, the system parameters may be adaptively identified on a recursive basis to account for changes to the building system over time. A recursive system identification process is described in greater detail in reference to FIG. 12. For example, a state space representation for a system with changing model may be expressed as: x(k+1)=A(θ)x(k)+B(θ)u(k) y(k)=C(θ)x(k)+D(θ)u(k) where θ represents variable parameters in the system. A change to the physical geometry of the system (e.g., knocking down a wall) may result in a change to the system parameters. However, a change in disturbances to the system such as heat transfer through the exterior walls (e.g., a change in weather), heat generated from people in the building, or heat dissipated from electrical resistance within the building (e.g., a load change) may not result in a change to the system parameters because no physical change to the building itself has occurred.

Still referring to FIG. 5A, process 500 may include accounting for disturbances to the system (step 504). Disturbances to the system may include factors such as external weather conditions, heat generated by people in the building, or heat generated by electrical resistance within the building. In other words, disturbances to the system may include factors having an impact on system states (e.g., building temperature, building power use, etc.) other than controllable inputs to the system. While accounting for disturbances represents a departure from the deterministic state space model, a more robust solution in the presence of disturbances can be achieved by forming a stochastic state space representation.

In some embodiments, an observer-based design may be used to allow an estimation of the system states which may not be directly measurable. Additionally, such a design may account for measurement error in system states which have a noise distribution associated with their measurement (e.g., an exact value may not be accurately measurable). The stochastic state space representation for a system can be expressed as: x(k+1)=A(θ)x(k)+B(θ)u(k)+w(k) y(k)=C(θ)x(k)+D(θ)u(k)+v(k) w(k)˜N(0,Q)v(k)˜N(0,R) where w and v are disturbance and measurement noise variables. The solution to this state estimation problem may be given by the function: {circumflex over (x)}(k+1)=A(θ){circumflex over (x)}(k|k−1)+B(θ)u(k)+K(θ)[y(k)−ŷ(k|k−1)] ŷ(k|k−1)=C(θ){circumflex over (x)}(k|k−1)+D(θ)u(k),{circumflex over (x)}(0;θ) where K is the Kalman gain and the hat notation {circumflex over (x)}, ŷ implies an estimate of the state and output respectively. The notation (k+1|k) means the value at time step k+1 given the information at time step k. Therefore the first equation reads “the estimate of the states at time step k+1 given the information up to time step k” and the second equation reads “the estimate of the output at time step k given the information up to time step k−1.” The estimate of the states and outputs are used throughout the cost minimization problem over the prediction and control horizons.

Still referring to FIG. 5A, process 500 may further include developing a framework energy model of the building system using physical principles to describe the energy characteristics of the system in terms of undefined system parameters (step 506). The framework energy model may include generalized energy characteristics of the building system (e.g., thermal resistances, thermal capacitances, heat transfer rates, etc.) without determining numerical values for such quantities.

In some embodiments, model predictive control (MPC) may be used to develop the framework energy model. MPC is a unifying control methodology that incorporates technologies of feedback control, optimization over a time horizon with constraints, system identification for model parameters, state estimation theory for handling disturbances, and a robust mathematical framework to enable a state of the art controller. An exemplary MPC controller 1700 and diagrams which may develop and use a framework energy model are described in greater detail in reference to FIG. 5B-FIG. 10. In some embodiments a framework energy model for the building system may be developed (step 506) for two or more MPC controllers.

Still referring to FIG. 5A, process 500 may further include obtaining system parameters for the framework energy model of the building system (step 508). In some embodiments, the system parameters may be specified in advance, imported from a previously identified system, received from a separate process, specified by a user, or otherwise received or retrieved. In other embodiments, system parameters are identified using a system identification process such as process 1100, described in greater detail in reference to FIG. 11.

Referring now to FIG. 5B, a block diagram illustrating the components of a MPC controller 1700 is shown, according to an exemplary embodiment. MPC controller 1700 may include a communications interface 1702 for sending and receiving information such as system state information, pricing information, system model information, setpoint information, or any other type of information to or from any potential source or destination. Communications interface 1702 may include wired or wireless interfaces (e.g., jacks, antennas, transmitters, receivers, transceivers, wire terminals, etc.) for conducting data communications with the system or other data sources.

MPC controller 1700 may further include a processing circuit 1705 having a processor 1704 and memory 1706. Processor 1704 can be implemented as a general purpose processor, an application specific integrated circuit (ASIC), one or more field programmable gate arrays (FPGAs), a group of processing components, or other suitable electronic processing components. Memory 1706 may include one or more devices (e.g., RAM, ROM, Flash memory, hard disk storage, etc.) for storing data and/or computer code for completing and/or facilitating the various processes, layers, and modules described in the present disclosure. Memory 1706 may comprise volatile memory or non-volatile memory. Memory 1706 may include database components, object code components, script components, or any other type of information structure for supporting the various activities and information structures described in the present disclosure. According to an exemplary embodiment, the memory 1706 is communicably connected to the processor 1704 and includes computer instructions for executing (e.g., by the processor 1704) one or more processes described herein.

Memory 1706 may include an optimization module 1722 for completing an optimization procedure, an identification module 1724 for performing system identification, a state estimation module 1726 to estimate system states based on the data received via the communications interface 1702, and a state prediction module 1728 to predict future system states.

Memory 1706 may further include system model information 1712 and cost function information 1714. System model information 1712 may be received via the communications interface 1702 and stored in memory 1706 or may be developed by MPC controller 1700 using identification module 1724, processor 1704, and data received via communications interface 1702. System model information 1712 may relate to one or more energy models of a building system and may be used by processor 1704 in one or more processes using state estimation module 1726, state prediction module 1728, or optimization module 1722. Similarly, cost function information 1714 may be received via the communications interface 1702 and stored in memory 1706, or it may be developed by the MPC controller 1700 using data received via the communications interface 1702. Cost function information 1714 may be used by 1704 processor in one or more processes using the system identification module 1724 or optimization module 1722.

In some embodiments, MPC controller 1700 may compensate for an unmeasured disturbance to the system. MPC controller 1700 may be referred to as an offset-free or zero-offset MPC controller. In classical controls, the integral mode in PID controller serves to remove the steady state error of a variable. Similarly, the state space model can be augmented with an integrating disturbance d, as shown in the following equation, to guarantee zero offset in the steady state:

$\begin{bmatrix} {x\left( {k + 1} \right)} \\ {d\left( {k + 1} \right)} \end{bmatrix} = {{\begin{bmatrix} {A(\theta)} & B_{D} \\ 0 & I \end{bmatrix}\begin{bmatrix} {x(k)} \\ {d(k)} \end{bmatrix}} + {\begin{bmatrix} {B(\theta)} \\ 0 \end{bmatrix}{u(k)}} + {w(k)}}$ ${y(k)} = {{{\begin{bmatrix} {C(\theta)} & C_{D} \end{bmatrix}\begin{bmatrix} {x(k)} \\ d \end{bmatrix}}{x(k)}} + {{D(\theta)}{u(k)}} + {v(k)}}$ The number of integrating disturbances to introduce may equal the number of measurements needed to achieve zero offset, independent from tuning the controller.

Referring now to FIG. 6, a cascaded MPC system 600 is shown, according to an exemplary embodiment. System 600 may include an inner MPC controller 602 and an outer MPC controller 604. Inner MPC controller 606 may function within an inner control loop contained within an outer control loop. This inner-outer control loop architecture may be referred to as a “cascaded” control system.

Cascaded MPC system 600 disclosed herein has several advantages over a single MPC controller. For example, system 600 may allow inner MPC controller 602 to operate at a shorter sampling and control interval to quickly reject disturbances while outer MPC controller 604 may operate at a longer sampling and control interval to maintain optimal power usage. In some embodiments, the sampling and control execution time of inner MPC controller 602 may be around thirty seconds whereas the sampling and control execution time of outer MPC controller 604 may be around fifteen minutes. The choice of fifteen minutes may be driven by a frequency of changes in energy pricing data (e.g., in the real-time pricing rate structure, energy prices may change as frequently as once per fifteen minutes). However, in other embodiments longer or shorter control times may be used.

The cascaded design advantageously permits the development of a less complex energy model than could be achieved with a single comprehensive energy model for the entire building system. Another advantage of the cascaded design is that inner controller 602 and outer controller 604 may be decoupled in location. For example, the outer controller 604 may be implemented off-site or “in the cloud” whereas the inner controller 602 may be run in an on-site building supervisory environment (e.g., a building controller local to a building). In some embodiments, outer controller 604 may receive input from multiple building systems and may interact with multiple inner controllers.

Still referring to FIG. 6, inner MPC controller 602 may be responsible for keeping the building's power use 612 (P_(B)) at a power setpoint 622 (P_(sp)) by modulating a temperature setpoint 624 (T_(sp)). Inner MPC controller 602 may determine the necessary changes in the temperature setpoint 626 ({dot over (T)}_(sp)). As shown, changes 626 may be integrated through integrator block 630 before being sent to the building system 606 as temperature setpoint 624 (T_(sp)). Outer MPC controller 604 may use energy consumption and demand prices, 626 (C_(C,k)) and 628 (C_(D,k)) respectively, to determine an amount of power that should be deferred 632 (P_(D)). The deferred power 632 may be subtracted from an estimated building load 636. Feed forward predictor 640 may determine the estimated building load 636 using past weather and power use data 638.

The specific input and output variables for both inner MPC controller 602 and outer MPC controller 604 are provided for exemplary purposes only and are not intended to limit the scope of invention further than express limitations included in the appended claims.

Referring now to FIG. 7, a diagram illustrating the inputs and outputs for inner MPC controller 602 are shown, according to an exemplary embodiment. Inner MPC controller 702 may receive a power setpoint 722 (P_(sp)) as an input. In some embodiments, power setpoint 722 may be an optimal power usage as determined by outer MPC controller 604. In other embodiments, historical weather and power usage data 638 may be used to determine a typical building load 636 (e.g., a predicted or historical amount of energy needed to maintain the building temperature within temperature constraints). If a typical building load 636 is determined, outer MPC controller 604 may be used to determine an amount of power that should be deferred 632. In some embodiments, the amount of deferred power 632 is subtracted from the typical building load 636 before being sent to the inner MPC controller 702 as a power setpoint 722. The amount of deferred power 632 may be positive (e.g., subtracted from the typical building load 636) or negative (e.g., added to the typical building load 636).

Still referring to FIG. 7, inner MPC controller 702 may further receive a zone temperature 714 (T_(z)) as an input. Zone temperature 714 may be a variable representing a state of the system. In a single zone building, zone temperature 714 may be the measured temperature of the single building zone (e.g., a room, floor, area, combination of rooms or floors, etc.). In a more complex building with several zones, zone temperature 714 may be a weighted average of the temperatures of multiple building zones. In some embodiments, the weighted average may be based on the area or volume of one or more zones. Additionally, the weighted average may be based on the relative position of the zone temperatures within the demand response temperature range. For example, zone temperature 714 may be calculated as follows:

$T_{z} = {\sum\limits_{i}\;{w_{i}\left( \frac{T_{z,i} - T_{\min,i}}{T_{\max,i} - T_{\min,i}} \right)}}$ where w is the weight of a zone and T_(max) and T_(min) represent the minimum and maximum allowable temperatures for that zone. In this case, the variable representing the zone temperatures may be normalized (e.g., between 0 and 1). Zone temperature 714 may be measured directly, calculated from measured quantities (e.g., information representative of a measured temperature), or otherwise generated by the system. Information representative of a measured temperature may be the measured temperature itself or information from which a building temperature may be calculated.

Still referring to FIG. 7, inner MPC controller 702 may further receive a current power usage 712 of the building. Current power usage 712 may be received as a feedback input for inner MPC controller 702. Inner MPC controller 702 may attempt to control current power usage 712 to match power setpoint 722. In the exemplary embodiment, current power usage 712 is an amount of power currently used by the building. However, in other embodiments, power usage 712 may represent any other state of the system, depending on the variable or variables sought to be controlled. Power usage 712 may be measured directly from the building system, calculated from measured quantities, or otherwise generated by any other method or process.

Still referring to FIG. 7, inner MPC controller 702 may output the derivative of a temperature setpoint {dot over (T)}_(sp) 726. The derivative of the temperature setpoint 726 may be used by inner MPC controller 702 to control power usage 712. In a simple single-zone building, {dot over (T)}_(sp) 726 may be a rate at which the temperature setpoint 624 is to be increased or decreased for the single zone. In multiple-zone buildings, {dot over (T)}_(sp) 726 may be applied to the respective temperature setpoints for each individual zone. In other embodiments having multiple building zones, {dot over (T)}_(sp) 726 may be broken into multiple outputs using a weighted average calculation based on the relative positions of the zone temperatures within the demand response range.

In the exemplary embodiment, the derivative of the temperature setpoint 726 may be chosen as the output of the inner MPC controller 702 because the system 606 is expected to perform as a “negative 1” type system. In other words, a step change in the temperature setpoint 624 may cause a very small change in steady-state power usage. Therefore to prevent steady-state offset (or an offset the decays very slowly) the controller 702 may have two integrators. The first integrator may be implicit in the disturbance model of the MPC controller (e.g., included as an integrating disturbance) whereas the second integrator 630 may be explicitly located downstream of inner MPC controller 602, as shown in FIG. 6.

Although the exemplary embodiment uses a derivative of temperature setpoint 726 as the output variable for the inner MPC controller 702, other embodiments may use different output variables or additional output variables.

Referring now to FIG. 8, a diagram illustrating inputs and outputs for outer MPC controller 604 is shown, according to an exemplary embodiment. Outer MPC controller 604 may be responsible for calculating an amount of power to defer 632, based on current and future energy prices 626 and 628, while maintaining building temperature 614 within acceptable bounds. As long the temperature constraints are satisfied, temperature 614 may be allowed to fluctuate. Thus, the goal of the outer MPC controller 604 is to minimize the cost of energy subject to temperature constraints.

Still referring to FIG. 8, outer MPC controller 804 may receive the current zone temperature T_(z) 814 and the current power usage P_(B) 812 of the building system. As described in reference to FIG. 7, these two variables represent states of building system 606. Both states may be measured directly, calculated from measured quantities, or otherwise generated by building system 606. In some embodiments, controller 804 may receive information representative of a measured temperature and/or information representative of a measured power usage. Information representative of a measured temperature may be the measured temperature itself or information from which a building temperature may be calculated. Information representative of a measured power usage may be the measured power usage itself or information from which a building power usage may be calculated.

Still referring to FIG. 8, outer MPC controller 804 may further receive pricing information 826 including energy consumption and demand prices, C_(C,k) and C_(D,k) respectively, according to an exemplary embodiment. The electric consumption price C_(C,k) may be the cost per unit of energy consumed (e.g., $/J or $/kWh). C_(C,k) may be applied as a multiplier to the total amount of energy used in a billing cycle, a pricing period, or any other time period to determine an energy consumption cost. The demand price C_(D,k) may be an additional charge corresponding to the peak power (e.g., maximum rate of energy use) at any given time during a billing period. In a variable pricing scenario that has an on-peak, partial-peak, and off-peak time period, a customer may be charged a separate demand charge for the maximum power used during each pricing period. Pricing information 826 may include consumption and demand prices for one or more pricing periods or pricing levels including off-peak, partial-peak, on-peak, critical-peak, real-time, or any other pricing period or pricing level. In some embodiments, pricing information 826 may include timing information defining the times during which the various consumption prices and demand prices will be in effect.

In some embodiments, outer MPC controller 804 may further receive historical weather and power usage data. Historical weather and power usage data may be used to perform a feed-forward estimation of the building's probable power requirements. However, in other embodiments, this estimation may performed by a separate feed-forward module 640, as shown in FIG. 6. In further embodiments, historical weather and power usage data are not considered by the outer MPC controller 804 in determining the optimal power setpoint 822.

Referring now to FIG. 9, an energy transfer diagram 900 for building system is shown, according to an exemplary embodiment. Diagram 900 may represent a framework energy model of the building system for the inner MPC controller. In the exemplary embodiment, the building system is modeled in diagram 900 as a single-zone building with a shallow mass and a deep mass. The shallow mass may represent objects and/or materials in the building which have contact with the air inside the building (e.g., immediate wall material, drywall, furniture, floor, ceiling, etc.) whereas the deep mass may represent material which is separated from the air inside the building by the shallow mass (e.g., cement block, foundation, etc.).

Referring specifically to FIG. 9(a), T, C, and R, are used to represent temperatures, capacitances, and resistances, respectively, with the associated subscripts d, s, z, and O representing deep mass, shallow mass, zone air, and outside air, respectively. Also shown is the heat supplied 932 by people and electric resistance within the building ({dot over (Q)}_(L)), and the heat supplied 934 (or removed in the case of a negative number) by the HVAC system ({dot over (Q)}_(HVAC)).

Referring now to FIG. 9(b), the framework energy model is simplified by eliminating C_(d), C_(s), and {dot over (Q)}_(L), thereby significantly reducing the number of parameters in the model. A reduced number of parameters may increase the robustness of system identification and reduce the computational effort of the inner MPC controller. Because the major dynamics of the system may be fast compared to the time constants of the deep mass capacitance 902 (C_(d)), the shallow mass capacitance 904 (CA and the rate of change of the human and electric load 932 ({dot over (Q)}_(L)), these time varying sources of heat entering the zone temperature node 914 may be treated as a slowly moving disturbance. The slowly moving disturbance 940 may be represented as {dot over (Q)}_(D) which includes conduction and convection of outside air 942, heat transfer from the shallow mass 944, and heat generated from people and electrical use inside the building 932.

In the exemplary embodiment, {dot over (Q)}_(HVAC) 934 may be modeled as the output of a PI controller. Thus, the rate of change in zone temperature may be given by the equation: C _(z) {dot over (T)} _(z) =K _(q)[K _(P)(T _(sp) −T _(z))+K _(I) I]+{dot over (Q)}_(D) and the integral may be given by: İ=T _(sp) −T _(z)

Additionally, because {dot over (Q)}_(HVAC) 934 represents the power delivered to the system, additional equations may be introduced to compensate for the power lost in transportation. For example, in the case of a water cooled building, the energy balance may be maintained by heating water in the building which may be transported to a chiller/tower system where the heat may be expelled into to the atmosphere. In the exemplary embodiment, the transport process that converts the cooling power delivered to the building system to a power use at a cooling tower may be modeled by an over-damped second-order system with one (shorter) time constant τ₁ representing the delay and a second time constant τ₂ representing mass of cooling fluid. {umlaut over (P)}+(τ₁+τ₂){dot over (P)}+(τ₁τ₂)P=P _(ss) P _(ss) =K _(e)[K _(p)(T _(sp) −T _(z))+K _(I) I] The additional values that have been introduced are defined as follows: P is the power used by the cooling equipment (e.g., at the cooling/chilling towers), P_(B) is the power usage as measured by the building, K_(q) is coefficient that converts PID output to heating power, K_(e) is coefficient that converts PID output to a steady-state power usage by the central plant equipment, and τ₁ and τ₂ are the time constants of the power transport process.

Therefore, in an exemplary embodiment, the entire model needed by the inner MPC controller 602 can be represented by:

${{{\begin{bmatrix} {\overset{.}{T}}_{z} \\ \overset{.}{I} \\ \overset{.}{P} \\ \overset{¨}{P} \\ {\overset{.}{T}}_{sp} \\ {\overset{.}{P}}_{Dist} \end{bmatrix}{\quad\quad}} =}\quad}{\quad{\quad{\begin{bmatrix} \frac{{- K_{q}}K_{P}}{C_{z}} & \frac{K_{q}K_{I}}{C_{z}} & 0 & 0 & \frac{K_{q}K_{P}}{C_{z}} & 0 \\ {- 1} & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\ {{- K_{e}}K_{p}} & {K_{e}K_{I}} & {{- \tau_{1}}\tau_{2}} & {{- \tau_{1}} - \tau_{2}} & {K_{e}K_{P}} & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix}{\quad{\quad{{{\quad\quad}\begin{bmatrix} T_{z} \\ I \\ P \\ \overset{.}{P} \\ T_{sp} \\ P_{Dist} \end{bmatrix}} + {\quad{\quad{\quad{\left. \quad{{{{\quad\quad}\left\lbrack \begin{matrix} 0 & 0 \\ 0 & 0 \\ 0 & 0 \\ 0 & 0 \\ 1 & 0 \\ 0 & 1 \end{matrix} \right\rbrack}\begin{bmatrix} {\overset{.}{T}}_{sp} \\ {\overset{.}{P}}_{Dist} \end{bmatrix}}\mspace{101mu}\begin{matrix} T_{z} \\ P_{B} \end{matrix}} \right\rbrack = {\begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} T_{z} \\ I \\ P \\ \overset{.}{P} \\ T_{sp} \\ {\overset{.}{P}}_{Dist} \end{bmatrix}}}\mspace{20mu}}}}}}}}}}$ where {dot over (Q)}_(D) 940 as well as any power usage by loads other than HVAC equipment may be incorporated into the power disturbance P_(Dist), which may be added to the measured power output P_(B) 612. Advantageously, modeling P_(Dist) in such a way may allow for offset free control in the presence of slowly changing disturbances.

In the exemplary embodiment, after converting to discrete time and substituting θ variables for the unknown system parameters, the complete inner loop framework energy model may be given by:

$\begin{bmatrix} {T_{z}\left( {k + 1} \right)} \\ {I\left( {k + 1} \right)} \\ {P\left( {k + 1} \right)} \\ {\overset{.}{P}\left( {k + 1} \right)} \\ {P_{Dist}\left( {k + 1} \right)} \end{bmatrix} = {{\left\lbrack \begin{matrix} {1 - \theta_{1}} & {\theta_{1}\theta_{2}} & 0 & 0 & 0 \\ {- 1} & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 \\ {- \theta_{3}} & {\theta_{2}\theta_{3}} & {{- \theta_{4}}\theta_{5}} & {1 - \theta_{4} - \theta_{5}} & 0 \\ 0 & 0 & 0 & 0 & 1 \end{matrix} \right\rbrack\left\lbrack \begin{matrix} {T_{z}(k)} \\ {I(k)} \\ {P(k)} \\ {\overset{.}{P}(k)} \\ {P_{Dist}(k)} \end{matrix} \right\rbrack} + {\quad{{\begin{bmatrix} \theta_{1} \\ 1 \\ 0 \\ \theta_{3} \\ 0 \end{bmatrix}{{T_{sp}(k)}\mspace{20mu}\begin{bmatrix} {T_{z}(k)} \\ {P_{B}(k)} \end{bmatrix}}} = {\begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 \end{bmatrix}\begin{bmatrix} {T_{z}(k)} \\ {I(k)} \\ {P(k)} \\ {\overset{.}{P}(k)} \\ {P_{Dist}(k)} \end{bmatrix}}}}}$ Although the discrete time model shows P_(Dist) as a constant, a Kalman gain (used in the state estimation process) may be used to optimally convert measurement errors to state estimation error, thereby causing P_(Dist) to change.

Referring now to FIG. 10, an energy transfer diagram 1000 for building system is shown, according to an exemplary embodiment. Diagram 1000 may represent a framework energy model of the building system for the outer MPC controller. Referring specifically FIG. 10(a), a complete energy diagram for the outer loop framework energy model is shown, according to an exemplary embodiment. For the outer control loop, all forms of capacitance 1002, 1004, and 1006 in the building may be included in the model because it may no longer be sufficient to treat the heat transfer from the shallow mass 1044 as a slowly moving disturbance. For example knowledge of the states of these capacitors and how heat is transferred between them may be relevant to a prediction of how zone temperature 1014 will change. In other words, an objective of the outer loop model may be to predict the state of these capacitors.

Referring now to FIG. 10(b), a simplified energy diagram for the outer loop framework energy model is shown. Two simplifying assumptions may be made in converting the complete energy diagram (FIG. 10(a)) to the simplified energy diagram (FIG. 10(b)). First, it may be assumed that the energy transferred through external conduction and convection 1042 and the typical load profile at a constant setpoint {dot over (Q)}_(L2) 1032 can be estimated based on time of day and temperature difference between the outside air temperature 1048 and the zone 1014 (e.g., T_(o)−T_(z)). Estimation may performed by the feed forward load predictor 640 shown in FIG. 6. The random portion of the load profile (e.g., the portion that is independent of time of day and temperature difference) may be represented an integrated disturbance {dot over (Q)}_(D2) 1040.

Second, in an exemplary embodiment, energy transfer equations describing the model shown in FIG. 10(b) may be expressed as:

${C_{z}{\overset{.}{T}}_{z}} = {\frac{T_{s} - T_{z}}{R_{sz}} + {\overset{.}{Q}}_{L\; 2} + {\overset{.}{Q}}_{D2} + {\overset{.}{Q}}_{HVAC}}$ ${C_{s}{\overset{.}{T}}_{s}} = {\frac{T_{d} - T_{s}}{R_{ds}} + \frac{T_{z} - T_{s}}{R_{sz}}}$ ${C_{s}{\overset{.}{T}}_{s}} = {\frac{T_{d} - T_{s}}{R_{ds}} + \frac{T_{z} - T_{s}}{R_{sz}}}$ To convert these equations to the framework energy model used by outer MPC controller 604, the heat transfers may be converted to powers that can be measured at the meter by assuming a constant of proportionality between the two. For example, {dot over (Q)}_(HVAC) may be converted to P_(HVAC) by multiplying by a coefficient of performance.

In the exemplary embodiment, inputs to the outer MPC controller 604 may be divided into controllable inputs, measured disturbances (e.g., uncontrollable but measurable inputs), and unmeasured disturbances (e.g., uncontrollable and unmeasured inputs). To make this division, the inputs may be reformulated to P_(C) (e.g., the power required to keep the zone temperature constant) and P_(D) (e.g., the deferred power). P_(D) may be a controllable input because it may be possible to control the amount of power to defer. P_(C) may be a measured disturbance because it may be possible to estimate the power required maintain a constant building temperature based the difference between outdoor air temperature and the temperature within the building. In some embodiments, estimation of P_(C) (P_(L2) and the portion of P_(HVAC) that comes from a constant setpoint) may be performed in a feed forward fashion as shown in FIG. 6. Finally, P_(D2) may be an unmeasured disturbance and can be viewed as the estimation error in P_(C). Thus, the framework energy model of the building system used by the outer MPC controller may be expressed as:

${{\left\lbrack \begin{matrix} {\overset{.}{T}}_{d} \\ {\overset{.}{T}}_{s} \\ {\overset{.}{T}}_{z} \\ {\overset{.}{P}}_{D\; 2} \end{matrix} \right\rbrack = {{\left\lbrack \begin{matrix} \frac{- 1}{R_{ds}C_{d}} & \frac{1}{R_{ds}C_{d}} & 0 & 0 \\ \frac{1}{R_{ds}C_{s}} & {- \left( {\frac{1}{R_{ds}C_{s}} + \frac{1}{R_{sz}C_{s}}} \right)} & \frac{1}{R_{sz}C_{s}} & 0 \\ 0 & \frac{1}{R_{sz}C_{z}} & \frac{- 1}{R_{sz}C_{z}} & K_{1} \\ 0 & 0 & 0 & 0 \end{matrix} \right\rbrack\left\lbrack \begin{matrix} T_{d} \\ T_{s} \\ T_{z} \\ P_{D\; 2} \end{matrix} \right\rbrack} +}}\quad}{\quad{\left\lbrack \begin{matrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ K_{2}^{\prime} & 0 & 0 \\ 0 & 0 & 1 \end{matrix} \right\rbrack{\quad{\left\lbrack \begin{matrix} P_{D} \\ {P_{C}\left( {{T_{OA} - T_{z}},t} \right)} \\ {\overset{.}{P}}_{D\; 2} \end{matrix} \right\rbrack\;{\quad\mspace{85mu}{\begin{bmatrix} T_{z} \\ P_{B} \end{bmatrix} = {{\left\lbrack \begin{matrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{matrix} \right\rbrack\left\lbrack \begin{matrix} T_{d} \\ T_{s} \\ T_{z} \\ P_{D\; 2} \end{matrix} \right\rbrack} + {\quad{\left\lbrack \begin{matrix} 0 & 0 & 0 \\ {- 1} & 1 & 0 \end{matrix} \right\rbrack\left\lbrack \begin{matrix} P_{D} \\ {P_{C}\left( {{T_{OA} - T_{z}},t} \right)} \\ {\overset{.}{P}}_{D\; 2} \end{matrix} \right\rbrack}}}}}}}}}$

Advantageously, in the exemplary embodiment, P_(C) may be a function of a state of the building system (e.g., P_(C)=f(T_(OA)−T_(z),t)). This is a condition that many MPC implementations would not support. The alternative would be to perform feed forward estimation outside the MPC controller. However, this is suboptimal because the feed forward estimator would be unable predict how altering the setpoint 622 would affect P_(c) because it would have no information regarding the current or predicted zone temperature T_(z) 1014. For example, presently deferring power will result in the zone temperature 1014 becoming closer to the outside temperature 1048, thereby decreasing the rate of heat transfer 1042 through the walls of the building. By incorporating the load predictor into the MPC controller, this change can be predicted and P_(c) can be adjusted accordingly.

In the exemplary embodiment, the outer loop model can be simplified further by assuming that changes in the deep mass temperature 1052 (T_(d)) occur at a rate that is much slower than the length of time power use can be deferred. With this assumption, the temperature of the deep mass 1052 may be considered a known input and the framework energy model used by outer MPC controller 604 may be expressed as:

$\begin{bmatrix} {T_{s}\left( {k + 1} \right)} \\ {T_{z}\left( {k + 1} \right)} \\ {P_{D\; 2}\left( {k + 1} \right)} \end{bmatrix} = {{\left\lbrack \begin{matrix} {1 - \left( {\theta_{1} + \theta_{2}} \right)} & \theta_{2} & 0 \\ \theta_{3} & {- \theta_{3}} & \theta_{4} \\ 0 & 0 & 1 \end{matrix} \right\rbrack\left\lbrack \begin{matrix} {T_{s}(k)} \\ {T_{z}(k)} \\ {P_{D\; 2}(k)} \end{matrix} \right\rbrack} + {\quad{\left\lbrack \begin{matrix} \theta_{1} & 0 & 0 \\ 0 & \theta_{4} & 0 \\ 0 & 0 & 0 \end{matrix} \right\rbrack{\quad{{\begin{bmatrix} {T_{d}(k)} \\ {P_{D}(k)} \\ {P_{C}\left( {{T_{OA} - T_{z}},k} \right)} \end{bmatrix}\mspace{20mu}\begin{bmatrix} {T_{z}(k)} \\ {P_{B}(k)} \end{bmatrix}} = {{\begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} {T_{s}(k)} \\ {T_{z}(k)} \\ {P_{D\; 2}(k)} \end{bmatrix}} + {\begin{bmatrix} 0 & 0 & 0 \\ 0 & {- 1} & 1 \end{bmatrix}\begin{bmatrix} {T_{d}(k)} \\ {P_{D}(k)} \\ {P_{C}\left( {{T_{OA} - T_{z}},k} \right)} \end{bmatrix}}}}}}}}$

Referring now to FIG. 11, a flowchart of a process 1100 to identify unspecified system parameters in a framework model is shown, according to an exemplary embodiment. Process 1100 may use an offline (batch) process to identify system parameters using a set of training data (e.g., sample input and output data used to gauge the response of the building system). However, in other embodiments, other system identification processes may be used. Process 1100 may be used to identify model parameters θ which minimize the cost of prediction error (e.g., the cost of differences between model-predicted outputs and the true system outputs).

In the exemplary embodiment, process 1100 may include receiving a framework energy model for the building system (step 1102), receiving training data including system input data and system output data (step 1104), filtering the training data to remove extraneous disturbances (step 1106), receiving a first error cost function based on the difference between the filtered output training data and a model-predicted filtered output (step 1108), and using a first optimization procedure to determine system parameters which minimize the first error cost function within a range of filtered training data (step 1110).

In some embodiments, process 1100 may further include receiving a second error cost function based on the difference between non-filtered output training data and a model-predicted non-filtered output (step 1112), and using a second optimization procedure to determine Kalman gain parameters which minimize the second error cost function within a range of non-filtered training data (step 1114).

Referring more particularly to FIG. 11, process 1100 includes receiving a framework energy model for the building system (step 1102). The framework energy model may be a framework energy model for the entire system or may be a framework energy model for either the inner MPC controller or outer MPC controller. In the exemplary embodiment, step 506 of process 500 may be used to develop a framework model using a discrete time state space representation of the building system with variable system parameters θ. For example, the framework energy model of the building system used by the inner MPC controller can be expressed as:

$\begin{bmatrix} {T_{z}\left( {k + 1} \right)} \\ {I\left( {k + 1} \right)} \\ {P\left( {k + 1} \right)} \\ {\overset{.}{P}\left( {k + 1} \right)} \end{bmatrix} = {{{\begin{bmatrix} {1 - \theta_{1}} & {\theta_{1}\theta_{2}} & 0 & 0 \\ {- 1} & 1 & 0 & 0 \\ 0 & 0 & 1 & 1 \\ {- \theta_{3}} & {\theta_{2}\theta_{3}} & {{- \theta_{4}}\theta_{5}} & {1 - \theta_{4} - \theta_{5}} \end{bmatrix}\begin{bmatrix} {T_{z}(k)} \\ {I(k)} \\ {P(k)} \\ {\overset{.}{P}(k)} \end{bmatrix}} + {\begin{bmatrix} \theta_{1} \\ 1 \\ 0 \\ \theta_{3} \end{bmatrix}{{T_{sp}(k)}\mspace{20mu}\begin{bmatrix} {T_{z}(k)} \\ {P(k)} \end{bmatrix}}}} = {\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}\begin{bmatrix} {T_{z}(k)} \\ {I(k)} \\ {P(k)} \\ {\overset{.}{P}(k)} \end{bmatrix}}}$ and the framework energy model used by the outer MPC controller can be expressed as:

${{\quad{\left\lbrack \begin{matrix} {T_{s}\left( {k + 1} \right)} \\ {T_{z}\left( {k + 1} \right)} \end{matrix} \right\rbrack = {{\left\lbrack \begin{matrix} {1 - \left( {\theta_{1} + \theta_{2}} \right)} & \theta_{2} \\ \theta_{3} & {1 - \theta_{3}} \end{matrix} \right\rbrack\left\lbrack \begin{matrix} {T_{s}(k)} \\ {T_{z}(k)} \end{matrix} \right\rbrack} + {\left\lbrack \begin{matrix} 0 & 0 \\ \theta_{4} & 0 \end{matrix} \right\rbrack\left\lbrack \begin{matrix} {P_{D}(k)} \\ {P_{C}\left( {{T_{OA} - T_{z}},t} \right)} \end{matrix} \right\rbrack}}}\quad}\begin{bmatrix} T_{z} \\ P_{B} \end{bmatrix}} = {{\left\lbrack \begin{matrix} 0 & 1 \\ 0 & 0 \end{matrix} \right\rbrack\left\lbrack \begin{matrix} {T_{s}(k)} \\ {T_{z}(k)} \end{matrix} \right\rbrack} + {\left\lbrack \begin{matrix} 0 & 0 \\ {- 1} & 1 \end{matrix} \right\rbrack\left\lbrack \begin{matrix} {P_{D}(k)} \\ {P_{C}\left( {{T_{OA} - T_{z}},t} \right)} \end{matrix} \right\rbrack}}$ In both models, terms representing the slowly moving disturbances may be removed as these disturbances may be subsequently accounted for using a Kalman gain, described in greater detail in reference to steps 1112 and 1114.

Still referring to FIG. 11, process 1100 may further include receiving training data including system input data and system output data (step 1104). Training data may be received by varying the manipulated inputs to the system and monitoring the resultant system outputs. For example, for the inner MPC controller system model, the temperature setpoint may be varied whereas for the outer MPC controller system model, the power setpoint be varied. For both models, the actual building temperature and building power use may be monitored and recorded as output training data. In other embodiments, other manipulated variables may be varied depending on the framework model used for this step of the system identification process.

Still referring to FIG. 11, process 1100 may include filtering the training data to remove extraneous disturbances (step 1106). Step 1106 may be performed to distinguish (a) a change in system outputs caused by varying the manipulated inputs from (b) a change in system outputs caused by external disturbances to the system. For example, in the exemplary embodiment, the effect of heat transfer through the walls of the building P_(C) (T_(OA)−T_(z)) may be treated as a slowly moving disturbance with dynamics much slower than that of the inner MPC controller system. By filtering the training data, the effect of this disturbance may be eliminated, thereby allowing the actual system parameters θ to be identified with greater accuracy.

In the exemplary embodiment, the filter applied to the training data may be a fourth-order high-pass Bessel filter with a cutoff frequency ω_(c) of 1.75*10⁻³ rad/s. However, in other embodiments, other types of filters may be used, including band-pass filters, low-pass filters, or other types of high-pass filters with different cutoff frequencies. The type of filter may be driven by the frequency characteristics of the effects sought to be eliminated from the training data. For example, the cutoff frequency may be chosen to eliminate the effects of slowly moving disturbances such as weather conditions or internal heat generation within the building while still capturing the dynamics of the system as they exist without external disturbances.

Still referring to FIG. 11, process 1100 may further include receiving a first error cost function (step 1108). Because filtered training data may be used for steps 1106-1110, the first error cost function may be based on the difference between the filtered output training data and the model-predicted filtered output (e.g., the error e). In some embodiments, the first error cost function may be pre-defined, received from memory, specified by a user, or otherwise received from any other source or process. In other embodiments, receiving the first error cost function may include defining or deriving the first error cost function.

Exemplary first error cost functions may include: l[y(k)−ŷ(k−1)]=l[e(k)]=e ²(k) which may be optimal for normally distributed errors, but sensitive to outliers:

${\ell\left\lbrack {e(k)} \right\rbrack} = \left\{ \begin{matrix} {{c^{2}\sigma^{2}} + {c\;\sigma} - {e(k)}} & {{e(k)} < {{- c}\;\sigma}} \\ {e^{2}(k)} & {{{- c}\;\sigma} < {e(k)} < {c\;\sigma}} \\ {{c^{2}\sigma^{2}} - {c\;\sigma} + {e(k)}} & {{e(k)} > {c\;\sigma}} \end{matrix} \right.$ which linearizes error cost l for errors e outside specified bounds, and:

${\ell\left\lbrack {e(k)} \right\rbrack} = \left\{ \begin{matrix} {c^{2}\sigma^{2}} & {{e(k)} < {{- c}\;\sigma}} \\ {e^{2}(k)} & {{{- c}\;\sigma} < {e(k)} < {c\;\sigma}} \\ {c^{2}\sigma^{2}} & {{e(k)} > {c\;\sigma}} \end{matrix} \right.$ for which the error cost l does not increase once the error e exceeds a threshold.

Still referring to FIG. 11, process 1100 may further include using a first optimization procedure to determine system parameters which minimize the first error cost function over a range of filtered training data (step 1110). Numerous optimization procedures may be used to minimize the first error cost function, including Gauss-Newton, Ninness-Wills, adaptive Gauss-Newton, Gradient Descent, and Levenberg-Marquardt search algorithms. The optimization procedure may use any of these search algorithms, a subset thereof, or any other minimization technique, algorithm, method, or procedure. For optimization purposes, initial system states may be estimated, received from a separate process, specified by a user, or fixed at any value.

The first error cost function may be used to determine the cost of prediction error within a range of filtered training data. The range of filtered training data may comprise the entire set of training data or a subset thereof. The training data used by the first error cost function may be automatically specified, chosen by a user, or otherwise determined by any other method or process.

Still referring to FIG. 11, process 1100 may further include receiving a second error cost function (step 1112). In some embodiments, the second error cost function may be pre-defined and may simply be received from memory, specified by a user, or otherwise received from any other source or process. In other embodiments, receiving the second error cost includes defining the second error cost function.

The second error cost function may use the same error cost algorithm as the first error cost function or it may use a different algorithm. However, unlike the first error cost function, the second error cost function may be based on the difference between the model-predicted output and the actual system output using the non-filtered training data.

Still referring to FIG. 11, process 1100 may further include using a second optimization procedure to determine Kalman gain parameters which minimize the second error cost function over a range of non-filtered training data (step 1114). In some embodiments, the Kalman gain can be parameterized and estimated along with the parameters of the system matrix as part of the first optimization procedure. In other embodiments, the system parameters may be estimated first using filtered training data while the Kalman gain parameters are fixed at zero. Then, the system parameters may be fixed and a second optimization procedure may be used to determine optimal Kalman gain parameters which minimize the cost of prediction error using the non-filtered training data.

Advantageously, determining the system parameters first allows for a more accurate prediction and reduces the possibility that the optimization procedure will settle on one of the local minima produced by estimating both the system parameters and the Kalman gain parameters simultaneously. Additionally, a separately determined Kalman gain may allow the MPC controller to predict future outputs, estimate system states, and optimally attribute measurement errors to either errors in the state estimate or to measurement noise.

Another advantage of process 1100 is the ability to estimate the current value of the load P_(C). Thus, in the exemplary embodiment, the framework energy model shown in the following equations is used to estimate the steady-state Kalman gain for the building system model used by the inner MPC controller:

$\begin{bmatrix} {T_{z}\left( {k + 1} \right)} \\ {I\left( {k + 1} \right)} \\ {P_{\Delta}\left( {k + 1} \right)} \\ {{\overset{.}{P}}_{\Delta}\left( {k + 1} \right)} \\ {P_{C}\left( {k + 1} \right)} \end{bmatrix} = {{\begin{bmatrix} {1 - \theta_{1}} & {\theta_{1}\theta_{2}} & 0 & 0 & 0 \\ {- 1} & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 \\ {- \theta_{3}} & {\theta_{2}\theta_{3}} & {{- \theta_{4}}\theta_{5}} & {1 - \theta_{4} - \theta_{5}} & 0 \\ 0 & 0 & 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} {T_{z}(k)} \\ {I(k)} \\ {P_{\Delta}(k)} \\ {{\overset{.}{P}}_{\Delta}(k)} \\ {P_{C}(k)} \end{bmatrix}} + {\quad{{{\begin{bmatrix} \theta_{1} \\ 1 \\ 0 \\ \theta_{3} \\ 0 \end{bmatrix}{T_{sp}(k)}} + {{v(k)}\mspace{20mu}\begin{bmatrix} {T_{z}(k)} \\ {P_{B}(k)} \end{bmatrix}}} = {{\begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 \end{bmatrix}\begin{bmatrix} {T_{z}(k)} \\ {I(k)} \\ {P_{\Delta}(k)} \\ {{\overset{.}{P}}_{\Delta}(k)} \\ {P_{C}(k)} \end{bmatrix}} + {w(k)}}}}}$ with a parameterized Kalman gain of:

${K(\theta)} = \begin{bmatrix} \theta_{6} & \theta_{7} \\ \theta_{8} & \theta_{9} \\ \theta_{10} & \theta_{11} \\ \theta_{12} & \theta_{13} \\ \theta_{14} & \theta_{15} \end{bmatrix}$

In the exemplary embodiment, the Kalman gain may be estimated for the outer MPC controller model using the following equations:

$\begin{bmatrix} {T_{s}\left( {k + 1} \right)} \\ {T_{z}\left( {k + 1} \right)} \\ {P_{D\; 2}\left( {k + 1} \right)} \end{bmatrix} = {\begin{bmatrix} {1 - \left( {\theta_{1} + \theta_{2}} \right)} & \theta_{2} & 0 \\ \theta_{3} & {1 - \theta_{3}} & \theta_{4} \\ 0 & 0 & \varphi_{1} \end{bmatrix}{\quad{{\begin{bmatrix} {T_{s}(k)} \\ {T_{z}(k)} \\ {P_{D\; 2}(k)} \end{bmatrix} + {{\begin{bmatrix} \theta_{1} & 0 & 0 & 0 \\ 0 & \theta_{4} & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} {T_{d}(k)} \\ {P_{D}(k)} \\ {P_{C}\left( {{T_{OA} - T_{z}},k} \right)} \\ {{\overset{\sim}{P}}_{D\; 2}(k)} \end{bmatrix}}\begin{bmatrix} {T_{z}(k)} \\ {P_{B}(k)} \end{bmatrix}}} = {\begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}{\quad{\begin{bmatrix} {T_{s}(k)} \\ {T_{z}(k)} \\ {P_{D\; 2}(k)} \end{bmatrix} + {\begin{bmatrix} 0 & 0 & 0 & 0 \\ 0 & {- 1} & 1 & 0 \end{bmatrix}\begin{bmatrix} {T_{d}(k)} \\ {P_{D}(k)} \\ {P_{C}\left( {{T_{OA} - T_{z}},k} \right)} \\ {{\overset{\sim}{P}}_{D\; 2}(k)} \end{bmatrix}}}}}}}}$ with a parameterized Kalman gain of:

${K(\theta)} = \begin{bmatrix} \theta_{6} & \theta_{7} \\ \theta_{8} & \theta_{9} \\ \theta_{10} & \theta_{11} \end{bmatrix}$ The parameters in the A and B matrices may be held constant at the values identified by the first optimization procedure while K is determined by the second optimization procedure using the non-filtered training data.

In the exemplary embodiment, initial values for the system states may be estimated by assuming that assumed that the system states are initially at a steady-state (e.g., x⁻¹ is the same as x₀). With this assumption the following algebraic equation may be solved to find the initial conditions for the states: x _(k) =Ax _(k) +Bu _(k) ⇒x ₀=(I−A)⁻¹ Bu ₀. To solve this problem, it can be assumed that because the system states are at a steady-state and the temperature setpoint is constant, the zone temperature T_(z) is equal to the temperature setpoint. Additionally, the measured power may be assumed to be unchanging (e.g., {dot over (P)}_(Δ)=0) and can be attributed to the heat disturbances. Finally, at the steady-state, powers P_(Δ) and P_(C) may be interchangeable; therefore, P_(Δ) may be set to zero and P_(C) may be set to the current power usage. In this way, the state of the integrator can also be initialized to zero. With these assumptions in place, the process 1100 may identify the Kalman gain parameters using a second optimization procedure (step 1114) while fixing the system parameters at the values determined by the first optimization procedure.

Referring now to FIG. 12, a flowchart of a process 1200 to recursively identify model parameters is shown, according to an exemplary embodiment. Recursive system identification has several advantages over batch system identification. For example, in recursive identification, the current knowledge of system parameters may be stored in an identifier “state” which is used to determine the current estimate. The state of the identification algorithm may be updated, and the estimate recalculated, each time a new measurement is obtained. Because recursive identification allows the estimate to be updated with each new measurement, memory requirements may be significantly reduced as it is not required to store each measurement in memory. Additionally, computational time may be significantly reduced because a large number of optimization iterations are no longer required with every measurement.

Another advantage of recursive identification is adaptability. For example, a recursive identification process may be able to compensate for slowly changing system parameters and may overcome the difficulty in modeling a changing physical world. In the exemplary embodiment, model inaccuracies may be anticipated and the model may be adjusted recursively through feedback and weighting functions. Initial parameter values and system state values may be determined by the batch processing method 1100 previously disclosed or otherwise received from any other source.

Still referring to FIG. 12, process 1200 may include estimating updated values for the model parameters (e.g., the system parameters and/or the Kalman gain parameters, a subset of the system and/or Kalman gain parameters known to be more likely to change, etc.) each time a new data measurement is received (step 1202), checking the estimated model parameters for stability and robustness (step 1204), and either using the estimated model parameters to estimate system states (step 1206), or reverting to previous model parameters (1208).

In the exemplary embodiment, step 1202 may include using an estimation process inspired by the extended Kalman filter (EKF). The following derivation adapts the EKF to a generalized case of a multiple-input multiple-output (MIMO) system for use in process 1200. For example, the model parameters θ may be estimated using the following EKF equations: {circumflex over (θ)}(k+1)={circumflex over (θ)}(k)+L(k)[y(k)−ŷ(k|k−1)], L(k)=P _(θ)(k)

^(T)(k)[

(k)P _(θ)(k)

^(T)(k)+R]⁻¹, P _(θ)(k+1)=P _(θ)(k)+Q _(P) +L(k)[

(k)P _(θ)(k)

^(T)(k)+R]L ^(T)(k), where the state update matrix is the identity matrix and P_(θ)(k) is the parameter estimation error covariance. To calculate the time varying equivalent to the measurement equation, C, for the EKF, the generic update equation for normal distributions may be used, as shown in the following equations: {circumflex over (θ)}(k+1)={circumflex over (θ)}(k)+Σ_(θω)Σ_(ωω) ⁻¹[y(k)−ŷ(k|k−1)], P _(θ)(k+1)=P _(θ)(k)+Q _(P)+Σ_(θω)Σ_(ωω) ⁻¹Σ_(θω) ^(T) Σ_(θω) =E{[θ(k)−{circumflex over (θ)}(k)][y(k)−ŷ(k|k−1)]^(T)}, Σ_(ωω) =E{[y(k)−ŷ(k|k−1)][y(k)−ŷ(k|k−1)]^(T)}. where Σ_(θω) and Σ_(ωω) are the cross covariance between the parameter estimation error and the output estimation error and the covariance of the output estimation error, respectively. To calculate these to covariance matrices recursively and obtain the EKF equations shown above, the actual measurement may be approximated linearly as:

y ⁡ ( k ) ≈ C ⁡ ( θ ^ ⁡ ( k ) ) · x ^ ⁡ ( k | k - 1 ) + D ⁡ ( θ ^ ⁡ ( k ) ) · u ⁡ ( k ) + x = x ^ θ = θ ^ ⁢ ( θ ⁡ ( k ) - θ ^ ⁡ ( k ) ) + w ⁡ ( k ) . Using this linear approximation, the covariances Σ_(θω) and Σ_(ωω) can be approximated as follows:

⁢∑ θω ⁢ = E ⁢ { [ θ ⁡ ( k ) - θ ^ ⁡ ( k ) ] ⁡ [ y ⁡ ( k ) - y ^ ⁡ ( k | k - 1 ) ] T } , ⁢ ⁢ ∑ θω ⁢ = E ⁢ { [ θ ⁡ ( k ) - θ ^ ⁡ ( k ) ] [ x = x ^ θ = θ ^ ⁢ ( θ ⁡ ( k ) - θ ^ ⁡ ( k ) ) + w ⁡ ( k ) ] T } , ⁢ ⁢ ∑ θω ⁢ = P θ ⁢ x = x ^ θ = θ ^ T , ⁢ ⁢ ∑ ωω ⁢ = E ⁢ { [ y ⁡ ( k ) - y ^ ⁡ ( k | k - 1 ) ] ⁡ [ y ⁡ ( k ) - y ^ ⁡ ( k | k - 1 ) ] T } , ⁢ ∑ ωω ⁢ = E ⁢ { [ x = x ^ θ = θ ^ ⁢ ( θ ⁡ ( k ) - θ ^ ⁡ ( k ) ) + w ⁡ ( k ) ] [ x = x ^ θ = θ ^ ⁢ ( θ ⁡ ( k ) - θ ^ ⁡ ( k ) ) + w ⁡ ( k ) ] T } , ⁢ ⁢ ∑ ωω ⁢ = x = x ^ θ = θ ^ ⁢ P θ ⁢ x = x ^ θ = θ ^ T + R . and used to update the parameter estimates in the EKF equations shown above.

In the exemplary embodiment,

may be resolved by assuming that the state estimate is equal to the actual state for a given parameter value. While this may not be true due to noise in the system, it may asymptotically true in terms of the expected parameter values. Because the system state estimates are also functions of the model parameters,

can then be written as,

${{\left( {\theta;k} \right)} = {\frac{d}{d\;\theta}\left\lbrack {{{C(\theta)} \cdot {\overset{\sim}{x}\left( {\theta;\left. k \middle| {k - 1} \right.} \right)}} + {{D(\theta)} \cdot {u(k)}}} \right\rbrack}},$ and using the product rule, as:

${\left( {\theta;k} \right)} = {{{C(\theta)}\frac{d}{d\;\theta}{\hat{x}\left( {\theta;\left. k \middle| {k - 1} \right.} \right)}} + {\quad{\begin{bmatrix} {\frac{dC}{d\;\theta_{1}}{\hat{x}\left( {\theta;\left. k \middle| {k - 1} \right.} \right)}} & \begin{matrix} {\frac{dC}{d\;\theta_{1}}{\hat{x}\left( {\theta;\left. k \middle| {k - 1} \right.} \right)}} & \ldots & {\frac{dC}{d\;\theta_{d}}{\hat{x}\left( {\theta;\left. k \middle| {k - 1} \right.} \right)}} \end{matrix} \end{bmatrix} + {\quad{\begin{bmatrix} {\frac{dD}{d\;\theta_{1}}{u(k)}} & \begin{matrix} {\frac{dD}{d\;\theta_{2}}{u(k)}} & \ldots & {\frac{dD}{d\;\theta_{d}}{u(k)}} \end{matrix} \end{bmatrix},\mspace{20mu}{{\left( {\theta;k} \right)} = {{{C(\theta)}{\eta\left( {\theta;k} \right)}} + {\left( {{\theta;\hat{x}},{u;k}} \right).}}}}}}}}$

In the exemplary embodiment, the derivatives of the matrices C and D may be determined by the model parameters, whereas the derivative of the state estimate η may be estimated recursively using in the following equation:

η ⁡ ( θ ; k + 1 ) = ⁢ d d ⁢ ⁢ θ ⁢ x ^ ⁡ ( θ ; k + 1 | k ) = ⁢ d d ⁢ ⁢ θ ⁡ [ A ⁡ ( θ ) ⁢ x ^ ⁡ ( θ ; k | k - 1 ) + B ⁡ ( θ ) ⁢ u ⁡ ( k ) + K ⁡ ( θ ) ⁢ ɛ ⁡ ( k ) ] , = ⁢ A ⁡ ( θ ) ⁢ η ⁡ ( θ ; k ) - K ⁡ ( θ ) ⁢ ⁢ ( θ ; k ) + ⁢ [ dA d ⁢ ⁢ θ 1 ⁢ x ^ ⁡ ( θ ; k | k - 1 ) dA d ⁢ ⁢ θ 2 ⁢ x ^ ⁡ ( θ ; k | k - 1 ) … dA d ⁢ ⁢ θ d ⁢ x ^ ⁡ ( θ ; k | k - 1 ) ] + ⁢ [ d ⁢ ⁢ B d ⁢ ⁢ θ 1 ⁢ u ⁡ ( k ) d ⁢ ⁢ B d ⁢ ⁢ θ 2 ⁢ u ⁡ ( k ) … d ⁢ ⁢ B d ⁢ ⁢ θ d ⁢ u ⁡ ( k ) ] + ⁢ [ dK d ⁢ ⁢ θ 1 ⁢ ɛ ⁡ ( k ) dK d ⁢ ⁢ θ 2 ⁢ ɛ ⁡ ( k ) … dK d ⁢ ⁢ θ d ⁢ ɛ ⁡ ( k ) ] . = ⁢ A ⁡ ( θ ) ⁢ η ⁡ ( θ ; k ) - K ⁡ ( θ ) ⁢ ⁢ ( θ ; k ) + ⁢ ( θ ; x ^ , u ; k ) + ɛ ⁢ ( θ ; ɛ ; k ) where ɛ(k) ≡ y(k) − ŷ(k|k − 1)

Therefore, recursive system identification process 1200 may use the following restated equations to estimate updated values for the model parameters each time a new measurement is obtained (step 1202): ŷ(k|k−1)=C({circumflex over (θ)}(k)){circumflex over (x)}(k|k−1)+D({circumflex over (θ)}(k))u(k) ε(k)=y(k)−ŷ(k|k−1)

(k)=C({circumflex over (θ)}(k))η(k)+

({circumflex over (θ)}(k);{circumflex over (x)},u;k) L(k)=P _(θ)(k)

^(T)(k)[

(k)P _(θ)(k)

^(T)(k)+R]⁻¹ {circumflex over (θ)}(k+1)={circumflex over (θ)}(k)+L(k)ε(k)

Process 1200 may further include includes using the updated model parameters to estimate the system states (step 1206). An EKF could be developed to estimate both the system states and the model parameters simultaneously; however, this configuration may not converge if the noise properties of the system are unknown. Therefore, in an exemplary embodiment, system states may be estimated using a Kalman gain which is dependent on the model parameters according to the following difference equations: {circumflex over (x)}(k+1|k)=A({circumflex over (θ)}(k)){circumflex over (x)}(k|k−1)+B({circumflex over (θ)}(k))u(k)+K({circumflex over (θ)}(k))ε(k), P _(θ)(k+1)=P _(θ)(k)+Q _(P) +L(k)[

(k)P _(θ)(k)

^(T)(k)+R]L ^(T)(k), η(k+1)=A({circumflex over (θ)}(k))η(k)−K({circumflex over (θ)}(k))

(k)+

({circumflex over (θ)}(k);{circumflex over (x)},u;k)+

_(ε)({circumflex over (θ)}(k);ε;k) which follow from the derivation above.

Still referring to FIG. 12, process 1200 may further include checking the estimated model parameters for stability and robustness (step 1204) and reverting to previous model parameters if the estimated model parameters are either unstable or non-robust (step 1208). In the exemplary embodiment, step 1204 may be accomplished using the estimated model parameters to update the difference equations shown above and then checking the updated equations for stability. The difference equations may be stable if, for the domain

, the parameters are such that the eigenvalues of A−KC are strictly less than one. In other words: θ∈

⊂

^(d) iff eig{A(θ)−K(θ)C(θ)}<1 Thus, to keep the difference equations stable, the parameter update equation may be replaced with:

${\hat{\theta}\left( {k + 1} \right)} = \left\{ \begin{matrix} {{{\hat{\theta}(k)} + {{L(k)}{ɛ(k)}}},} & {{{\hat{\theta}(k)} + {{L(k)}{ɛ(k)}}} \in} \\ {{\hat{\theta}(k)},} & {{{\hat{\theta}(k)} + {{L(k)}{ɛ(k)}}} \notin} \end{matrix} \right.$ Therefore, in some embodiments, the model parameters are not updated (step 1208) (e.g., the estimated value is not used and the parameters revert to their previous values) if the estimated values would result in instability.

Advantageously, process 1200 achieves improved robustness by considering the effect of outlying raw data. For example, for a squared error cost function, the gradient of the cost function (at a given sample) may be stated as −

ε. Thus, process 1200 may be a modified descent process in which the EKF equations (e.g., the parameter update equations used in step 1202) are used to scale and modify the direction of the descent. For example, the gradient of the cost function may be stated as:

${{\nabla J_{ɛ}} = {- (k)\frac{d\;\ell}{d\;\theta}}},$ which when applied to the following cost function, becomes:

${\ell\left\lbrack {e(k)} \right\rbrack} = \left\{ {\left. \begin{matrix} {c^{2}\sigma^{2}} & {{e(k)} < {{- c}\;\sigma}} \\ {e^{2}(k)} & {{{- c}\;\sigma} < {e(k)} < {c\;\sigma}} \\ {c^{2}\sigma^{2}} & {{e(k)} > {c\;\sigma}} \end{matrix}\rightarrow{\nabla J_{e}} \right. = \left\{ \begin{matrix} 0 & {{e(k)} < {{- c}\;\sigma}} \\ {- (k){ɛ(k)}} & {{{- c}\;\sigma} < {e(k)} < {c\;\sigma}} \\ 0 & {{e(k)} > {c\;\sigma}} \end{matrix} \right.} \right.$ Thus, in process 1200 the parameter set may not be updated (step 1208) if the output estimation error is large (e.g., exceeds a threshold defined by cσ.

Referring now to FIG. 13, a flowchart of a cost function definition process 1300 is shown, according to an exemplary embodiment. Process 1300 may be used to accomplish some or all of step 406 of process 400. In the exemplary embodiment, process 1300 may include receiving time-varying pricing information for a plurality of pricing periods (step 1302), receiving a time horizon (step 1304), expressing the total cost of energy within the time horizon as a function of estimated power use (step 1306), expressing the cost function as a liner equation by adding demand charge constraints to the optimization procedure (step 1308), and using a masking procedure to invalidate demand charge constraints for inactive pricing periods (step 1310).

Still referring to FIG. 13, process 1300 may include receiving pricing information including energy charge information and demand charge information for a plurality pricing periods (step 1302). However, in other embodiments, pricing information may include only energy charge information or only demand charge information or such information may pertain to only one pricing period.

Energy charge information may include the cost of energy for some or all of the pricing periods. In an exemplary embodiment, the cost of energy is defined on a per-unit basis (e.g., $/Joule, $/kWh, etc.). However, in other embodiments, energy cost may be defined on a progressive or regressive basis, segmented into one or more fixed-cost ranges of energy use, or make use of any other cost structure.

Demand charge information may include a cost corresponding to the peak power usage during one or more of the pricing periods (e.g., the maximum power used at any given time within a pricing period or combination of periods). The demand charge may be imposed for some or all of the pricing periods and pricing periods may overlap (e.g., an “anytime” period would overlap with any other period or periods). In an exemplary embodiment, the demand charge information may define the cost of power on a per-unit basis (e.g., $/W, $/kW, etc.). However, in other embodiments, the demand charge may be imposed on a progressive or regressive basis, segmented into one or more fixed-cost ranges of maximum power use, or make use of any other cost structure.

In the exemplary embodiment, pricing periods may include two or more different periods chosen from the group consisting of: off-peak, partial-peak, on-peak, critical-peak, and real-time. However, in other embodiments, more or fewer pricing periods may be used. In some embodiments, the critical-peak pricing period may be subdivided into several sub-periods having different energy charges, different demand charges, or both, as shown in FIG. 2.

A pricing period may be a time interval during which certain energy charges and/or power demand charges apply. For example, during the off-peak period energy may cost $w per kWh and the demand charge may be $y per kW, whereas during the peak period energy may cost $x per kWh and the demand charge may be $z per kW. Different pricing periods may have (1) the same energy charge but a different demand charge, (2) a different energy charge but the same demand charge, (3) a different energy charge and a different demand charge, or (4) the same energy charge and the same demand charge (e.g., a customer may be charged a separate demand charge for each pricing period despite both periods having the same rates).

Two or more pricing periods may overlap and gaps may exist during which no pricing period is active. A pricing period may become inactive at a specified time and reactivate at a later time while still qualifying as the same pricing period (e.g., the on-peak period may recur every day from 9:00 A.M. until 9:00 P.M. as shown in FIG. 1). Energy charge information, demand charge information, and pricing period information, may be received from the same source or from different sources, concurrently or at different times.

Still referring to FIG. 13, process 1300 may further include receiving a time horizon (step 1304). A time horizon may define how far into the future to look when predicting future system states or planning future system inputs. The time horizon may function as a prediction horizon, a control horizon, or both, depending on the application of the control system. A prediction horizon may be used by the optimization procedure 1500 to define a time period during which the cost function is minimized. Similarly, the control horizon may be used by the optimization procedure 1500 to define a time period during which the manipulated inputs to the system may be controlled. In the exemplary embodiment, the time horizon may be used as both the prediction horizon and the control horizon and may be set to 5τ (e.g., five times a time constant of the system). However, in other embodiments, other time horizons may be used. The time horizon may be used by both the optimization procedure 1500 to minimize the cost function and by the masking procedure 1310 to selectively mask the inactive demand charge constraints.

Still referring to FIG. 13, process 1300 may further include using the time-varying pricing information and the time horizon to express the total cost within the time horizon as a function of estimated power use (step 1306). The optimization problem can be stated mathematically as minimizing the cost function:

$J_{ND} = {{\sum\limits_{i = 1}^{ND}{{EC}_{i}P_{i}\Delta\; t_{i}}} + {\sum\limits_{j = 1}^{M}{D\; C_{j}\mspace{11mu}{\max_{Rj}\left( P_{j} \right)}}}}$ subject to the constraints: T _(mini) <T _(z,i) <T _(maxi) ∀i However, only the first term of this function is linear. The second term of the cost function includes a “max” operation which selects the maximum power usage at any given time during the relevant pricing period.

Still referring to FIG. 13, process 1300 may further include expressing the cost function as a linear equation with demand charge constraints on the optimization problem (step 1308). To facilitate implementation of the “max” function in an automated optimization process (e.g., a process which minimizes the cost function within a finite time horizon), the cost function can be expressed as:

$J_{k} = {{\sum\limits_{i = 1}^{N_{p}}{{EC}_{i}P_{i}\Delta\; t_{i}}} + {\sum\limits_{j = 1}^{M}{D\; C_{Rj}P_{Rj}}}}$ subject to constraints: (P _(i) −P _(j))_(k) ≤P _(R) for all i samples within a time horizon and for all j demand charge regions (e.g., pricing periods), where P_(R) represents the maximum power in the region from previous time steps in the billing cycle. For example, the value of P_(R) may initially be zero at the beginning of a billing cycle and may increase due to constraints on the zone temperature T_(z).

Still referring to FIG. 13, process 1300 may further include masking the demand charge constraints on the optimization problem which apply to inactive pricing periods (step 1310). Step 1310 may be performed because all demand charge constraints may not be valid for each discrete time-step used in the optimization procedure. For example, referring to FIG. 14, the time horizon 1402 may extend from a time-step 1404 (k) in the partial-peak period 1406 to a future time 1408 (k+horizon) in the peak period 1410. At time-step k 1404, the demand charge constraint which applies to the peak period 1410 may be masked (e.g., marked as inactive, invalidated, deleted, erased, etc.) because time-step k 1404 does not occur during the peak period 1410. In other words, the peak pricing period 1410 is “inactive” at time-step k 1404. Similarly, the demand charge constraints which apply to the partial-peak period 1406 may be masked for all time steps within the time horizon 1402 which occur after the partial-peak period 1406 has ended.

In the exemplary embodiment, step 1310 (e.g., the masking procedure) may be included as part of process 1300 because step 1310 completes the linearization of the demand charge term by masking invalid constraints. However, in other embodiments, the step 1310 may be implemented as part of the optimization procedure 1500, as part of another process, or as an entirely separate process. In further embodiments, step 1310 may be combined with step 1308 (imposition of the demand charge constraints) so that only valid demand charge constraints are initially imposed. In such embodiments, the term “valid demand charge constraints” may be redundant because all demand charge constraints may be valid.

Referring now to FIG. 15, a flowchart illustrating an energy cost optimization process 1500 is shown, according to an exemplary embodiment. Process 1500 may include receiving an energy model of the building system, system state information, temperature constraints, and an energy cost function including demand charge constraints (step 1502), using the energy model and the system state information to formulate equality constraints (step 1504), and determining an optimal power usage or setpoint to minimize the total cost of energy within a finite time horizon (e.g., minimize the energy cost determined by the cost function) while maintaining building temperature within acceptable bounds and satisfying the equality constraints and demand charge constraints (step 1506).

Process 1500 may include receiving an energy model of the building system, system state information, temperature constraints, and an energy cost function including demand charge constraints (step 1502). The energy model for the building system may be received as a pre-defined model or may be defined or derived using a model development process such as process 500, described in reference to FIG. 5.

The energy model of the building system (e.g., the system model) may be a representation of the used by the optimization procedure to predict future system states. For the outer loop MPC controller, the system model may be used to predict the value of the zone temperature T_(z) in response to changes to the power setpoint P_(sp) or changes to the amount of power to defer P_(D). A state space representation of the outer MPC controller system model may be expressed as:

$\begin{bmatrix} {T_{s}\left( {k + 1} \right)} \\ {T_{z}\left( {k + 1} \right)} \\ {P_{D\; 2}\left( {k + 1} \right)} \end{bmatrix} = {\begin{bmatrix} {1 - \left( {\theta_{1} + \theta_{2}} \right)} & \theta_{2} & 0 \\ \theta_{3} & {- \theta_{3}} & \theta_{4} \\ 0 & 0 & 1 \end{bmatrix}{\quad{{\begin{bmatrix} {T_{s}(k)} \\ {T_{z}(k)} \\ {P_{D\; 2}(k)} \end{bmatrix} + {{\begin{bmatrix} \theta_{1} & 0 & 0 \\ 0 & \theta_{4} & 0 \\ 0 & 0 & 0 \end{bmatrix}\begin{bmatrix} {T_{d}(k)} \\ {P_{D}(k)} \\ {P_{C}\left( {{T_{OA} - T_{z}},k} \right)} \end{bmatrix}}\mspace{20mu}\begin{bmatrix} {T_{z}(k)} \\ {P_{B}(k)} \end{bmatrix}}} = {\begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}{\quad{\begin{bmatrix} {T_{s}(k)} \\ {T_{z}(k)} \\ {P_{D\; 2}(k)} \end{bmatrix} + {\begin{bmatrix} 0 & 0 & 0 \\ 0 & {- 1} & 1 \end{bmatrix}\begin{bmatrix} {T_{d}(k)} \\ {P_{D}(k)} \\ {P_{C}\left( {{T_{OA} - T_{z}},k} \right)} \end{bmatrix}}}}}}}}$

For the inner loop MPC controller, the system model may be used to predict the amount of power used by the building P_(B) in response to changes in the temperature setpoint T_(sp). A state space representation of the inner MPC controller system model may be expressed as:

$\begin{bmatrix} {T_{z}\left( {k + 1} \right)} \\ {I\left( {k + 1} \right)} \\ {P\left( {k + 1} \right)} \\ {\overset{.}{P}\left( {k + 1} \right)} \\ {P_{Dist}\left( {k + 1} \right)} \end{bmatrix} = {\quad{\begin{bmatrix} {1 - \theta_{1}} & {\theta_{1}\theta_{2}} & 0 & 0 & 0 \\ {- 1} & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 \\ {- \theta_{3}} & {\theta_{2}\theta_{3}} & {{- \theta_{4}}\theta_{5}} & {1 - \theta_{4} - \theta_{5}} & 0 \\ 0 & 0 & 0 & 0 & 1 \end{bmatrix}{\quad{{\begin{bmatrix} {T_{z}(k)} \\ {I(k)} \\ {P(k)} \\ {\overset{.}{P}(k)} \\ {P_{Dist}(k)} \end{bmatrix} + {\begin{bmatrix} \theta_{1} \\ 1 \\ 0 \\ \theta_{3} \\ 0 \end{bmatrix}{{T_{sp}(k)}\mspace{20mu}\begin{bmatrix} {T_{z}(k)} \\ {P_{B}(k)} \end{bmatrix}}}} = {\begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \end{bmatrix}{\quad{{\begin{bmatrix} {T_{z}(k)} \\ {I(k)} \\ {P(k)} \\ {\overset{.}{P}(k)} \\ {P_{Dist}(k)} \end{bmatrix}\mspace{20mu}{K(\theta)}} = \begin{bmatrix} \theta_{6} & \theta_{7} \\ \theta_{8} & \theta_{9} \\ \theta_{10} & \theta_{11} \\ \theta_{12} & \theta_{13} \\ \theta_{14} & \theta_{15} \end{bmatrix}}}}}}}}$

In some embodiments, the system model may have static system parameters. In other embodiments, the system model may contain variable system parameters which may be altered by the optimization procedure to adapt the model to a changing system. The system model may be fully developed with identified parameters, or the system parameters may need to be identified using a system identification process. If system identification is required, the system parameters θ₁-θ₅ (and possibly the Kalman gain parameters θ₆-θ₁₅) may be identified using a system identification process 1100 and received by optimization process 1500 as part of the system model.

System state information may include a current estimation of some or all or the relevant system states. In the state space system models shown above, current system states are represented by the variables having a time step equal to k (e.g., T_(z)(k), T_(s)(k), etc.). Initial system states may be estimated, measured, chosen arbitrarily, calculated, received from another process, from a previous iteration of the optimization procedure, specified by a user, or received from any other source. For example, in an exemplary embodiment of the outer MPC controller system model, the system state information may include an estimation of the zone temperature T_(z), the shallow mass temperature T_(s), and the unmeasured disturbance power P_(D2). Because P_(D2) is a slowly changing disturbance, it can be estimated once as its value does not change during the prediction horizon.

Temperature constraints may be limitations on the building zone temperature T_(z) or any other system state. The temperature constraints may include a minimum allowable temperature, a maximum allowable temperature, or both, depending on the application of the control system. Temperature constraints may be received automatically, specified by a user, imported from another process, retrieved from a data base, or otherwise received from any other source. An energy cost function may include information relating to energy prices (e.g., energy charge information, demand charge information, pricing period information, etc.) and may include demand charge constraints as described in reference to FIG. 13.

Still referring to FIG. 15, process 1500 may further include using the energy model of the building system and the system state information to formulate equality constraints (step 1504). Equality constraints may be used to guarantee that the optimization procedure considers the physical realities of the building system (e.g., energy transfer principles, energy characteristics of the building, etc.) during cost minimization. In other words, equality constraints may be used to predict the building's response (e.g., how the system states and outputs will change) to a projected power usage or temperature setpoint, thereby allowing the energy cost function to be minimized without violating the temperature constraints.

Still referring to FIG. 15, process 1500 may further include determining an optimal power usage which minimizes the total cost within the time horizon while satisfying the equality constraints, the temperature constraints, and the demand charge constraints (step 1506). Many minimization procedures can be employed to perform cost minimization including Gauss-Newton, Ninness-Wills, adaptive Gauss-Newton, Gradient Descent, Levenberg-Marquardt, or any other optimization or search algorithm.

In some embodiments, process 1500 may be performed once to determine an optimal power usage within a time horizon. Given a long enough time horizon and a perfectly accurate model, a single use of process 1500 may be satisfactory. However, over time, the system model may lose accuracy due to the difficulty in modeling a changing physical world.

Referring now to FIG. 16, a flowchart of a process 1600 illustrating a recursive implementation of process 1500 is shown, according to an exemplary embodiment. Advantageously, process 1600 anticipates model inaccuracies and adjusts the model recursively through feedback and weighting functions. Process 1600 may improve adaptability of the system model and may insure long-term accuracy of the optimization procedure.

Still referring to FIG. 16, process 1600 may include receiving system state information, an energy cost function, temperature constraints, and an energy model of the building system including system parameter information (step 1602). The energy model of the building system and system state information may be received from a previously identified system or may be identified using a system identification process such as process 1100, described in detail in reference to FIG. 11. Alternatively, the energy model of the building system may be received from a different process, specified by a user, retrieved from a database, or otherwise received from any other source.

The energy cost function may express a total cost of energy as a function of actual or estimated power use within a time horizon. In some embodiments, the energy cost function may be received as a completely defined function. In other embodiments, the energy cost function may be defined using a definition process such as process 1300, described in detail in reference to FIG. 13. To facilitate automated processing, the energy cost function may be expressed as a linear equation by adding demand charge constraints to the optimization procedure.

Still referring to FIG. 16, process 1600 may further include using the system state information to formulate demand charge constraints (step 1604). An example demand charge constraint may be stated as (P_(i)−P_(j))_(k)≤P_(R) where P_(R) represents the maximum power in the demand charge region from previous time steps in the billing cycle. In the exemplary embodiment, system state information may information regarding estimated or actual power use for a previous time-step. Thus, system state information may be used to resolve the value of P_(R) in a demand charge constraint. Step 1604 may be substantially equivalent to step 1308 in process 1300.

Still referring to FIG. 16, process 1600 may further include using the masking procedure to invalidate the demand charge constraints which apply to inactive pricing periods (step 1606). In some embodiments, step 1606 may be performed because not all of the demand charge constraints are valid for each discrete time step used in the optimization procedure. In other embodiments, only valid demand charge constraints may be initially imposed and step 1606 may be unnecessary.

Still referring to FIG. 16, process 1600 may further include using the system model and system state information to formulate equality constraints (step 1608). Step 1608 may allow the optimization procedure to accurately predict the effects of changing inputs to the building system so that the cost function can be minimized without violating the temperature constraints.

Still referring to FIG. 16, process 1600 may further include determining an optimal power usage which minimizes the total energy cost as determined by the cost function within a time horizon while satisfying the equality constraints, the temperature constraints, and the demand charge constraints (step 1610). Many minimization procedures can be employed to perform cost minimization including Gauss-Newton, Ninness-Wills, adaptive Gauss-Newton, Gradient Descent, Levenberg-Marquardt, or any other optimization or search algorithm.

Still referring to FIG. 16, process 1600 may further include updating the system model and system state information (step 1612). Step 1612 may be accomplished using recursive system identification process 1200, batch system identification process 1100 or any other update process. The updated system model and system state information may be used to update the equality constraints and demand charge constraints a subsequent iteration of the recursive process. For example, the system state information may include power usage information for previous time-steps. This information may be used to update the value of P_(R) if necessary (e.g., if the power used during the last unrecorded time-step was greater than the stored value of P_(R)) so that P_(R) continues to represent the maximum power used in a demand charge region during the current billing cycle. Steps 1604-1612 may be performed recursively.

The construction and arrangement of the systems and methods as shown in the various exemplary embodiments are illustrative only. Although only a few embodiments have been described in detail in this disclosure, many modifications are possible (e.g., variations in sizes, dimensions, structures, shapes and proportions of the various elements, values of parameters, mounting arrangements, use of materials, colors, orientations, etc.). For example, the position of elements may be reversed or otherwise varied and the nature or number of discrete elements or positions may be altered or varied. Accordingly, all such modifications are intended to be included within the scope of the present disclosure. The order or sequence of any process or method steps may be varied or re-sequenced according to alternative embodiments. Other substitutions, modifications, changes, and omissions may be made in the design, operating conditions and arrangement of the exemplary embodiments without departing from the scope of the present disclosure.

The present disclosure contemplates methods, systems and program products on any machine-readable media for accomplishing various operations. The embodiments of the present disclosure may be implemented using existing computer processors, or by a special purpose computer processor for an appropriate system, incorporated for this or another purpose, or by a hardwired system. Embodiments within the scope of the present disclosure include program products comprising machine-readable media for carrying or having machine-executable instructions or data structures stored thereon. Such machine-readable media can be any available media that can be accessed by a general purpose or special purpose computer or other machine with a processor. By way of example, such machine-readable media can comprise RAM, ROM, EPROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to carry or store desired program code in the form of machine-executable instructions or data structures and which can be accessed by a general purpose or special purpose computer or other machine with a processor. Combinations of the above are also included within the scope of machine-readable media. Machine-executable instructions include, for example, instructions and data which cause a general purpose computer, special purpose computer, or special purpose processing machines to perform a certain function or group of functions.

Although the figures may show a specific order of method steps, the order of the steps may differ from what is depicted. Also two or more steps may be performed concurrently or with partial concurrence. Such variation will depend on the software and hardware systems chosen and on designer choice. All such variations are within the scope of the disclosure. Likewise, software implementations could be accomplished with standard programming techniques with rule based logic and other logic to accomplish the various connection steps, processing steps, comparison steps and decision steps. 

What is claimed is:
 1. A heating, ventilation, or air conditioning (HVAC) system for a building, the HVAC system comprising: a building system comprising one or more measurement devices configured to measure at least one of a measured temperature of the building or a measured power usage of the building and generate a feedback signal comprising at least one of the measured temperature of the building or the measured power usage of the building; a load predictor configured to predict a future power usage of the building; an outer controller configured to receive the feedback signal from the building system, receive time-varying pricing information, perform an optimization process to determine an amount of power to defer from the predicted future power usage based on the feedback signal and the pricing information, and output a power control signal indicating the amount of power to defer, wherein the amount of power to defer optimizes a total cost of power usage of the building; an inner controller configured to receive a power setpoint representing a difference between the predicted future power usage and the amount of power to defer, determine an operating setpoint for the building system predicted to achieve the power setpoint, and output a second control signal indicating the operating setpoint; and HVAC equipment comprising one or more physical devices, wherein the building system is configured to operate the HVAC equipment to achieve the operating setpoint; wherein at least one of the outer controller or the inner controller is an electronic device comprising a communications interface and a processing circuit.
 2. The HVAC system of claim 1, wherein the feedback signal includes both information representative of the measured temperature and information representative of the measured power usage of the building.
 3. The HVAC system of claim 2, wherein the outer controller is configured to: receive a dynamic model describing heat transfer characteristics of the building and temperature constraints defining an acceptable range for the measured temperature; use the dynamic model and the feedback signal to estimate a temperature state for the building as a function of power usage; and use an optimization procedure to determine a power usage for the building which minimizes the total cost of the power usage while maintaining the estimated temperature state within the acceptable range.
 4. The HVAC system of claim 1, wherein the outer controller and the inner controller have different sampling and control intervals, wherein the sampling and control interval of the outer controller is longer than the sampling and control interval of the inner controller.
 5. The HVAC system of claim 1, wherein the outer controller and the inner controller are physically decoupled in location.
 6. The HVAC system of claim 1, wherein the time-varying pricing information includes demand charge information defining a cost per unit of power corresponding to a maximum power usage within a pricing period.
 7. The HVAC system of claim 6, wherein the time-varying pricing information includes the demand charge information for two or more of a plurality of pricing periods.
 8. The HVAC system of claim 1, wherein the second control signal includes at least one of: the operating setpoint; or a derivative of the operating setpoint.
 9. The HVAC system of claim 1, wherein the power control signal includes at least one of: the power setpoint received by the inner controller; or the amount of power to defer from the predicted future power usage, wherein the amount of power to defer is subtracted from the predicted future power usage to calculate the power setpoint received by the inner controller.
 10. The HVAC system of claim 9, wherein the load predictor configured to: receive the operating setpoint and at least one of: current weather information, past weather information, or past building power usage; and output the predicted power future usage, wherein the power control signal is the amount of power to defer from the predicted future power usage.
 11. A method for heating, ventilating, or air conditioning a building, the method comprising: measuring, by a measuring device, at least one of a measured temperature of the building or a measured power usage of the building; generating, by the measuring device, a feedback signal comprising at least one of the measured temperature of the building or the measured power usage of the building; predicting, by a load predictor, a future power usage of the building based on historical weather and power usage data; performing, by an outer controller, an optimization process to determine an amount of power to defer from the predicted future power usage based on the feedback signal and time-varying pricing information; generating, by the outer controller, a power control signal indicating the amount of power to defer, wherein the amount of power to defer optimizes a total cost of the power usage of the building; calculating, by the outer controller, a power setpoint representing a difference between the predicted future power usage and the amount of power to defer; determining, by an inner controller, an operating setpoint predicted to achieve the power setpoint; generating, by the inner controller, a second control signal indicating the operating setpoint; and operating, by at least one of the measuring device, the load predictor, the outer controller and the inner controller, HVAC equipment to achieve the operating setpoint, the HVAC equipment comprising one or more physical devices.
 12. The method of claim 11, wherein the feedback signal includes both information representative of the measured temperature and information representative of the measured power usage of the building.
 13. The method of claim 12, further comprising: receiving a dynamic model describing heat transfer characteristics of the building and temperature constraints defining an acceptable range for the measured temperature; using the dynamic model and the feedback signal to estimate a temperature state for the building as a function of the power usage; and using an optimization procedure to determine a power usage for the building which minimizes the total cost of the power usage while maintaining the estimated temperature state within the acceptable range.
 14. The method of claim 11, wherein the power control signal is generated by the outer controller having a first sampling and control interval and the second control signal is generated by the inner controller having a second sampling and control interval shorter than the first sampling and control interval.
 15. The method of claim 11, wherein the power control signal is generated by the outer controller and the second control signal is generated by the inner controller physically decoupled in location from the outer controller.
 16. The method of claim 11, wherein the time-varying pricing information includes demand charge information defining a cost per unit of power corresponding to a maximum power usage within a pricing period.
 17. The method of claim 16, wherein the time-varying pricing information includes the demand charge information for two or more of a plurality of pricing periods.
 18. The method of claim 11, wherein the second control signal includes at least one of: the operating setpoint; or a derivative of the operating setpoint.
 19. The method of claim 11, further comprising subtracting the amount of power to defer from the predicted future power usage to calculate the power setpoint; wherein the power control signal includes at least one of the power setpoint or the amount of power to defer from the predicted future power usage.
 20. The method of claim 19, further comprising: receiving the operating setpoint and at least one of: current weather information, past weather information, and past building power usage; and outputting the predicted future power usage, wherein the power control signal is the amount of power to defer from the predicted future power usage. 